note 88813 deleted from function.date by danbrown
| From: | danbrown@php.net | Date: | Thu, 12 Feb 2009 03:58:57 +0000 |
| Subject: | note 88813 deleted from function.date by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150551@lists.php.net to get a copy of this message | ||
Note Submitter: simonj at g
----
Don't assume the first week will always be at the start of the year.
The "W" (week of the year) will wrap at 52 back to one for the last couple of days.
<?php
$period = "D W Y";
$date1 = "28-DEC-08";
$date2 = "29-DEC-08";
echo date($period,strtotime($date1));
echo date($period,strtotime($date2));
?>
gives:
"Sun 52 2008"
"Mon 01 2008"