note 61977 deleted from function.date by derick

From: Date: Sun, 11 Jun 2006 11:43:54 +0000
Subject: note 61977 deleted from function.date by derick
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-114253@lists.php.net to get a copy of this message
Note Submitter: awibble at gmail dot com ---- 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.

« previous php.notes (#114253) next »