note 37150 added to function.date
| From: | crissi at parking dot ucr dot edu | Date: | Wed, 05 Nov 2003 01:49:09 +0000 |
| Subject: | note 37150 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-59917@lists.php.net to get a copy of this message | ||
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");
?>
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+37150
Delete -- http://master.php.net/manage/user-notes.php?action=delete+37150&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+37150&report=yes
Search -- http://master.php.net/manage/user-notes.php