note 75675 deleted from function.date by danbrown
| From: | danbrown@php.net | Date: | Sun, 20 Jul 2008 02:48:53 +0000 |
| Subject: | note 75675 deleted from function.date by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141989@lists.php.net to get a copy of this message | ||
Note Submitter: dmitriy dot yakovlev at gmail dot com
----
soreenpk - the code snippet you posted will not find the day difference between two days that are
not in the same month. This will:
<?php
$digest_date = "2007-06-01";
$date_diff = abs(strtotime(date('y-m-d'))-strtotime($digest_date)) / 86400;
?>
86400 is the number of seconds in a day, so finding the date difference in seconds and converting to
days will give true day difference between dates. Cheers.