note 97022 added to function.strtotime
| From: | subfader at gmail dot com | Date: | Mon, 29 Mar 2010 00:10:36 +0000 |
| Subject: | note 97022 added to function.strtotime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-167471@lists.php.net to get a copy of this message | ||
last month: the above example fails on dates like March 29th when there is no February 29th, So it
returns 03 as last month. Fix: Assume it's the 25th (or whatever day below 29).
$lastmonth0 = mktime(0, 0, 0, date("m")-1, 25, date("Y"));
$lastmonth = date("Y-m", $lastmonth0);
This returns 2010-02 on March 29th, 2010.
----
Server IP: 69.147.83.197
Probable Submitter: 95.115.244.31
----
Manual Page -- http://www.php.net/manual/en/function.strtotime.php
Edit -- https://master.php.net/note/edit/97022
Del: integrated -- https://master.php.net/note/delete/97022/integrated
Del: useless -- https://master.php.net/note/delete/97022/useless
Del: bad code -- https://master.php.net/note/delete/97022/bad+code
Del: spam -- https://master.php.net/note/delete/97022/spam
Del: non-english -- https://master.php.net/note/delete/97022/non-english
Del: in docs -- https://master.php.net/note/delete/97022/in+docs
Del: other reasons-- https://master.php.net/note/delete/97022
Reject -- https://master.php.net/note/reject/97022
Search -- https://master.php.net/manage/user-notes.php