note 67391 added to function.mktime

From: Date: Wed, 07 Jun 2006 17:25:34 +0000
Subject: note 67391 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-113609@lists.php.net to get a copy of this message
Easy way to get last month. ...and anything else in the date you want. Just introduce the calculation into the mktime function (note the -1) when building from date(). //Current Date minus one month. $dateMinusOneMonth = mktime(0, 0, 0, date("m")-1, date("d"), date("Y")); $lastmonth = date("M", $dateMinusOneMonth); echo $lastmonth; change $dateMinusOneMonth to the below to see it react to a year change (get Dec as last month from January) $dateMinusOneMonth = mktime(0, 0, 0, 01-1, 01, 2006); ---- Server IP: 64.71.164.2 Probable Submitter: 65.162.76.1 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.mktime.php Edit -- http://master.php.net/note/edit/67391 Del: integrated -- http://master.php.net/note/delete/67391/integrated Del: useless -- http://master.php.net/note/delete/67391/useless Del: bad code -- http://master.php.net/note/delete/67391/bad+code Del: spam -- http://master.php.net/note/delete/67391/spam Del: non-english -- http://master.php.net/note/delete/67391/non-english Del: in docs -- http://master.php.net/note/delete/67391/in+docs Del: other reasons-- http://master.php.net/note/delete/67391 Reject -- http://master.php.net/note/reject/67391 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#113609) next »