0

I am trying to assign tomorrow date to a variable in my program call $tomorrow, but i just cant seem to work out how to do it. Have done today's one by doing

$date = date('Y-m-d');

after reseraching I thought it will make sense to do this

$tomorrow = mktime(0, 0, 0, date("m") , date("d")+1, date("Y"));
but this produced a long number (1141689600). making no sense.

I want the output to be as the same format as the date function used above.

Please please please please can someone help me. Thanks in advance

5
Contributors
5
Replies
6
Views
11 Years
Discussion Span
Last Post by rahulgs
1

Troy's code will work just fine, here's another way of doing it:

$tomorrow = date('Y-m-d',mktime()+86400);
0

;)

Troy's code will work just fine, here's another way of doing it:

$tomorrow = date('Y-m-d',mktime()+86400);

Hi,

I think is better to use time() instead of mktime() in this case ;)

And a little explanation:

date() function get's two arguments. first one is date format, second one is function time() which get the current time in UNIX format.
We can manipulate time() function with - or + time.
so 86400 is the sum for the seconds in 24hours.
24*60*60 (24 hours * 60 mins * 60 sec).
Well date function will convert UNIX time time stamp to your date format. That's is...

excuse my english it's not my native language and i hope this will help you to understand how the things work out

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.