Page 1 of 1

mktime returning wrong value?

Posted: Tue Aug 18, 2009 11:31 am
by KeeganWolf
Hi,

I'm trying to use mktime to return tomorrows date. I read something at one point that this might be a php bug.

Code: Select all

 
$tomorrow = mktime(0,0,0,date("m"),date("d")+1,date("Y"));
echo $tomorrow;
 
Returns the output...
1250665200

Why would this be?

Re: mktime returning wrong value?

Posted: Tue Aug 18, 2009 1:27 pm
by Zoxive
I don't see the problem here.
php.net wrote: mktime() returns the Unix timestamp of the arguments given.

Re: mktime returning wrong value?

Posted: Tue Aug 18, 2009 4:03 pm
by Darhazer
Pass the result of mktime to date():

Code: Select all

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