note 78174 deleted from function.strtotime by danbrown

From: Date: Sun, 09 Jan 2011 17:03:50 +0000
Subject: note 78174 deleted from function.strtotime by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-175578@lists.php.net to get a copy of this message
Note Submitter: Beat ---- 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 ?>

« previous php.notes (#175578) next »