note 82321 added to function.mktime

From: Date: Sat, 05 Apr 2008 16:05:06 +0000
Subject: note 82321 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-137959@lists.php.net to get a copy of this message
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. ---- Server IP: 69.147.83.197 Probable Submitter: 78.107.120.66 ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- https://master.php.net/note/edit/82321 Del: integrated -- https://master.php.net/note/delete/82321/integrated Del: useless -- https://master.php.net/note/delete/82321/useless Del: bad code -- https://master.php.net/note/delete/82321/bad+code Del: spam -- https://master.php.net/note/delete/82321/spam Del: non-english -- https://master.php.net/note/delete/82321/non-english Del: in docs -- https://master.php.net/note/delete/82321/in+docs Del: other reasons-- https://master.php.net/note/delete/82321 Reject -- https://master.php.net/note/reject/82321 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#137959) next »