note 66967 deleted from function.mktime by bjori
| From: | bjori@php.net | Date: | Thu, 01 Jun 2006 18:35:58 +0000 |
| Subject: | note 66967 deleted from function.mktime by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-112800@lists.php.net to get a copy of this message | ||
Note Submitter: dguinn_alt at hotmail.com
Reason: bad code
----
Very easy to get last month and more reliable than subtracting. Works for Jan. also, returns Dec.
Criticism welcome!!! Enjoy!!!
<?PHP
//Example of January: Month declaration set to January minus 1 to get December.
//$dateMinusOneMonth = mktime(0, 0, 0, 01-1, 01, 2006);
//Current Date minus one month.
$dateMinusOneMonth = mktime(0, 0, 0, date("m")-1, date("d"),
date("Y"));
$lastmonth = date("M", $dateMinusOneMonth);
echo $lastmonth;
?>