note 14398 added to function.date.php
| From: | greg at destiney dot com | Date: | Mon, 30 Jul 2001 01:44:05 +0000 |
| Subject: | note 14398 added to function.date.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16042@lists.php.net to get a copy of this message | ||
These are some really cool calculations if you use timestamp(14) columns in MySQL.
<?
$now = date("YmdHis");
$yesterday =
date("YmdHis",mktime(date("H"),date("i"),date("s"),date("m"),date("d")-1,date("Y")));
$last_week =
date("YmdHis",mktime(date("H"),date("i"),date("s"),date("m"),date("d")-7,date("Y")));
$last_month =
date("YmdHis",mktime(date("H"),date("i"),date("s"),date("m"),date("d")-31,date("Y")));
echo "\$now = " . $now . "<br />";
echo "\$yesterday = " . $yesterday . "<br />\r\n";
echo "\$last_week = " . $last_week . "<br />\r\n";
echo "\$last_month = " . $last_month . "<br />\r\n";
?>
http://www.php.net/manual/en/function.date.php