note 61977 added to function.date

From: Date: Thu, 16 Feb 2006 15:18:01 +0000
Subject: note 61977 added to function.date
Groups: php.notes 
Request: Send a blank email to php-notes+get-103844@lists.php.net to get a copy of this message
Kyle, You can use Date and mktime to do what you are wanting to do. For example $lastmonth = date('h-i-s, j-m-y',mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); Thats just joining some of the above examples together. This would give you you the date, in the format 'h-i-s, j-m-y' i.e. (05-16-17, 10-03-01) that it was 1 month ago. If you wanted it to be 14 days, then this would do that... $twoWeeksAgo = date('h-i-s, j-m-y',mktime(0, 0, 0, date("m"), date("d")-14, date("Y"))); Hope that helps, i havent tested the code, but its not complex so should work fine, drop me an email if you need more help. ---- Server IP: 85.116.0.130 Probable Submitter: 86.139.92.238 ---- Manual Page -- http://www.php.net/manual/en/function.date.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61977 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61977&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61977&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61977&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61977&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61977&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61977&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61977&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61977&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#103844) next »