note 84531 deleted from function.time by aidan

From: Date: Wed, 15 Apr 2009 16:07:14 +0000
Subject: note 84531 deleted from function.time by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153335@lists.php.net to get a copy of this message
Note Submitter: Michael Konecny ---- It should be noted in the example, that time() + (7*24*60*60) and strtotime("+1 week") do not always generate the same timestamp. The problem occurs when the daylight saving time changes. Therefore it's usually better to use strtotime.. Example: the last time the time changed in the Czech republic was on the 30th March 2008, from 2:00 to 3:00. Assume it is Wednesday, the 26th March 2008, 23:59. If you call <?php echo date("l, jS F Y, H:i",strtotime("+1 week")); ?> you get Wednesday, 2nd April 2008, 23:59, as you would predict, although if you try <?php echo date("l, jS F Y, H:i",time()+(7*24*60*60)); ?> you get Thursday, 3rd April 2008, 00:59. Here's where things might get a bit confusing, if you don't expect it! Suddenly you find the food list for the next week is gone :D !

« previous php.notes (#153335) next »