note 74038 added to function.date
| From: | gilberto dot guerra at gmail dot com | Date: | Wed, 21 Mar 2007 20:00:37 +0000 |
| Subject: | note 74038 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-124682@lists.php.net to get a copy of this message | ||
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
----
Server IP: 69.147.83.197
Probable Submitter: 201.148.16.67 (proxied: 192.168.95.17)
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- https://master.php.net/note/edit/74038
Del: integrated -- https://master.php.net/note/delete/74038/integrated
Del: useless -- https://master.php.net/note/delete/74038/useless
Del: bad code -- https://master.php.net/note/delete/74038/bad+code
Del: spam -- https://master.php.net/note/delete/74038/spam
Del: non-english -- https://master.php.net/note/delete/74038/non-english
Del: in docs -- https://master.php.net/note/delete/74038/in+docs
Del: other reasons-- https://master.php.net/note/delete/74038
Reject -- https://master.php.net/note/reject/74038
Search -- https://master.php.net/manage/user-notes.php