note 97025 deleted from function.strtotime by derick

From: Date: Sun, 14 Dec 2014 11:41:03 +0000
Subject: note 97025 deleted from function.strtotime by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-201177@lists.php.net to get a copy of this message
Note Submitter: clarkDONTSPAMMEwise at gmail dot com ---- Always use the format strtotime("+1 day") when adding/subtracting units of time rather than manually adding 24*60*60 seconds to a timestamp, for example, as this format works as desired with Daylight Saving Time changes. If your timezone adheres to Daylight Saving Time, a situation like the following may apply to you: <?php date_default_timezone_set('America/Chicago'); // Don't do this: $today = '2009-11-01'; $tomorrow = strtotime($today) + 24*3600; print date('Y-m-d', $tomorrow); // Output: 2009-11-01 // Do this instead: $today = '2009-11-01'; $tomorrow = strtotime('+1 day', strtotime($today)); print date('Y-m-d', $tomorrow); // Output: 2009-11-02

« previous php.notes (#201177) next »