note 75698 added to function.date
| From: | john at hotmail dot com | Date: | Tue, 12 Jun 2007 13:55:32 +0000 |
| Subject: | note 75698 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127417@lists.php.net to get a copy of this message | ||
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 );
?>
----
Server IP: 194.145.210.3
Probable Submitter: 80.189.14.251
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/75698
Del: integrated -- https://master.php.net/note/delete/75698/integrated
Del: useless -- https://master.php.net/note/delete/75698/useless
Del: bad code -- https://master.php.net/note/delete/75698/bad+code
Del: spam -- https://master.php.net/note/delete/75698/spam
Del: non-english -- https://master.php.net/note/delete/75698/non-english
Del: in docs -- https://master.php.net/note/delete/75698/in+docs
Del: other reasons-- https://master.php.net/note/delete/75698
Reject -- https://master.php.net/note/reject/75698
Search -- https://master.php.net/manage/user-notes.php