note 74038 deleted from function.date by bjori
| From: | bjori@php.net | Date: | Fri, 20 Apr 2007 09:20:05 +0000 |
| Subject: | note 74038 deleted from function.date by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125605@lists.php.net to get a copy of this message | ||
Note Submitter: gilberto dot guerra at gmail dot com
----
Using the "d" parameter to obtain the difference between to dates won't work for days
on different months, because the result is obtained as a 'date' value, and not as a
'int'. (ex. 02-Feb-1969), and obtaining the "d" from date function, will return
"2".
You can use this line to obtain an absolute difference between two dates:
echo (int)((strtotime("02/12/2007")-strtotime("01/09/2007"))/86400);
// Wil return 34