note 88813 modified in function.date by thiago
| From: | thiago@php.net | Date: | Mon, 09 Feb 2009 12:31:04 +0000 |
| Subject: | note 88813 modified in function.date by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150411@lists.php.net to get a copy of this message | ||
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"
--was--
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.
$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"
http://php.net/manual/en/function.date.php