mktime returning wrong value?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
KeeganWolf
Forum Newbie
Posts: 19
Joined: Thu May 14, 2009 3:13 pm

mktime returning wrong value?

Post 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?
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Re: mktime returning wrong value?

Post by Zoxive »

I don't see the problem here.
php.net wrote: mktime() returns the Unix timestamp of the arguments given.
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: mktime returning wrong value?

Post 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")));
Post Reply