note 37150 deleted from function.date by kennyt
| From: | kennyt@php.net | Date: | Sun, 18 Jul 2004 17:30:22 +0000 |
| Subject: | note 37150 deleted from function.date by kennyt | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-73519@lists.php.net to get a copy of this message | ||
Note Submitter: crissi@parking.ucr.edu
----
Hey this is a quick and simple function that takes a date formated "Ymd" and returns a
"Ymd" formated date 60 days before it. It was used to allow people to purchase a new
parking permit 60 days before the expiration date of their current permit.
<?php
function minus60($date){
$year = substr($date, 0, 4);
$month = substr($date, 4, -2);
$day = substr($date, 6, 7);
$timestamp = mktime (0,0,0,$month,$day-60,$year);
return strftime ("%Y%m%d", $timestamp);
}
echo minus60("20031231");
?>