note 78174 added to function.strtotime

From: Date: Mon, 01 Oct 2007 22:41:20 +0000
Subject: note 78174 added to function.strtotime
Groups: php.notes 
Request: Send a blank email to php-notes+get-130972@lists.php.net to get a copy of this message
Here the workaround to the bug of strtotime() found in my previous comment on finding the exact date and time of "3 months ago of last second of this year", using mktime() properties on dates instead of strtotime(), and which seems to give correct results: <?php // check for equivalency $basedate = strtotime("31 Dec 2007 23:59:59"); $timedate = mktime( 23, 59, 59, 1, 0, 2008 ); echo "$basedate $timedate "; // 1199141999 1199141999 : SO THEY ARE EQUIVALENT // workaround, as mktime knows to handle properly offseted dates: $date1 = mktime( 23, 59, 59, 1 - 3, 0, 2008 ); echo date("j M Y H:i:s", $date1); // 30 Sep 2007 23:59:59 CORRECT ?> ---- Server IP: 69.147.83.197 Probable Submitter: 83.77.35.238 ---- Manual Page -- http://www.php.net/manual/en/function.strtotime.php Edit -- https://master.php.net/note/edit/78174 Del: integrated -- https://master.php.net/note/delete/78174/integrated Del: useless -- https://master.php.net/note/delete/78174/useless Del: bad code -- https://master.php.net/note/delete/78174/bad+code Del: spam -- https://master.php.net/note/delete/78174/spam Del: non-english -- https://master.php.net/note/delete/78174/non-english Del: in docs -- https://master.php.net/note/delete/78174/in+docs Del: other reasons-- https://master.php.net/note/delete/78174 Reject -- https://master.php.net/note/reject/78174 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#130972) next »