note 75698 deleted from function.date by tularis

From: Date: Thu, 09 Feb 2012 21:02:50 +0000
Subject: note 75698 deleted from function.date by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-186017@lists.php.net to get a copy of this message
Note Submitter: john at hotmail dot com ---- Just a small addition to dmitriy. If the present date is in daylight saving time, and the date in the past is not, the result will not be a whole number by dividing by 86400. It will be something like 48.958333333. This is because the day in which it changes from normal to daylight saving time is one hour longer than normal (90000 secs) and the opposite is true when changing back (the day would be one hour shorter - 82800 secs). If you want a whole number of days use the following instead: <?php $digest_date = "2007-01-01"; $date_diff = round( abs(strtotime(date('y-m-d'))-strtotime($digest_date)) / 86400, 0 ); ?>

« previous php.notes (#186017) next »