Page 1 of 1

get future date

Posted: Wed Oct 02, 2013 6:58 am
by nite4000
Hey I know this is simple to a lot and it is to me however seems like nothing I have tried works

When I am doing is getting the current date and time and inserting it into a field which I have got to work

However I need to go up by 1 day for the date but leaving the time the same

Here is what I have

Code: Select all



$newdate = mysql_result($checksurfed, 0, "date");


$newtime = mysql_result($checksurfed, 0, "time");
 

[b]$date1 = (date($newdate, strtotime($newdate)) . " +1 day");[/b]


$do_stats = mysql_query("UPDATE table SET field1='$date1 $newtime'") or die (mysql_error());


The code in bold is what I am trying to work with but its not going up by 1 day and then saving

Any help would be great

Re: get future date

Posted: Wed Oct 02, 2013 9:59 am
by AbraCadaver
I'm not sure what format your date needs to be in, but you need to read the docs for the two functions. Here's an example:

Code: Select all

$date1 = date('Y-m-d', strtotime('+1 day', $newdate));