note 97022 deleted from function.strtotime by danbrown
| From: | danbrown@php.net | Date: | Mon, 29 Mar 2010 00:34:45 +0000 |
| Subject: | note 97022 deleted from function.strtotime by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-167473@lists.php.net to get a copy of this message | ||
Note Submitter: subfader at gmail dot com
----
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.