kpetsche20 Posted December 29, 2008 Share Posted December 29, 2008 I need to add 3 days to a date, the date is in the format YYYY-MM-DD public function start_date_plus_3($league) { $sql = mysql_query("SELECT * FROM pleagues WHERE id = '".$league."'") or die(mysql_error()); while($data = mysql_fetch_array($sql)) { $starttime = $data['startdate'] $timestamp = strtotime($data['startdate']); } } Quote Link to comment Share on other sites More sharing options...
bluesoul Posted December 29, 2008 Share Posted December 29, 2008 I need to add 3 days to a date, the date is in the format YYYY-MM-DD public function start_date_plus_3($league) { $sql = mysql_query("SELECT * FROM pleagues WHERE id = '".$league."'") or die(mysql_error()); while($data = mysql_fetch_array($sql)) { $starttime = $data['startdate'] $timestamp = strtotime($data['startdate']); $newtime = strtotime("+3 days",$starttime); } } Quote Link to comment Share on other sites More sharing options...
Mark Baker Posted December 29, 2008 Share Posted December 29, 2008 $newdate = strtotime('+3 days',strtotime('2008-12-29')); Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted December 29, 2008 Share Posted December 29, 2008 Better to do it all in the query: $sql = mysql_query("SELECT *,UNIX_TIMESTAMP(startdate + INTERVAL 3 DAY) AS timestamp FROM pleagues WHERE id = '".$league."'") or die(mysql_error()); The timestamp would then be in $data['timestamp']; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.