note 82321 deleted from function.mktime by danbrown

From: Date: Sun, 20 Jul 2008 03:28:09 +0000
Subject: note 82321 deleted from function.mktime by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-142064@lists.php.net to get a copy of this message
Note Submitter: elnur dot home at gmail dot com ---- Reply to post: > Anonymous > 04-Apr-2008 04:30 > > While you might expect mktime() to give you the time of midnight if the hours parameter is set > to zero, it may not. Instead it returns noon in this example. PHP 5.2.4. > Example: > $ts_now = date('Y-m-d h:i:s'); // 2008-04-04 07:30:00 > $ts_then = date('Y-m-d h:i:s', mktime(0, 0, 0, date("m"), > date("d"), date("Y")+1)); // 2009-04-04 12:00:00 You mistakenly used "h" which stands for hours in 12-hours format. Use "H" instead and you'll see that the function gives you the time of midnight correctly.

« previous php.notes (#142064) next »