note 66967 added to function.mktime

From: Date: Thu, 01 Jun 2006 18:16:33 +0000
Subject: note 66967 added to function.mktime
Groups: php.notes 
Request: Send a blank email to php-notes+get-112799@lists.php.net to get a copy of this message
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; ?> ---- Server IP: 216.194.113.175 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/66967 Del: integrated -- http://master.php.net/note/delete/66967/integrated Del: useless -- http://master.php.net/note/delete/66967/useless Del: bad code -- http://master.php.net/note/delete/66967/bad+code Del: spam -- http://master.php.net/note/delete/66967/spam Del: non-english -- http://master.php.net/note/delete/66967/non-english Del: in docs -- http://master.php.net/note/delete/66967/in+docs Del: other reasons-- http://master.php.net/note/delete/66967 Reject -- http://master.php.net/note/reject/66967 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#112799) next »