note 35046 deleted from function.mktime by sniper
| From: | sniper@php.net | Date: | Tue, 04 Nov 2003 13:10:07 +0000 |
| Subject: | note 35046 deleted from function.mktime by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-59865@lists.php.net to get a copy of this message | ||
Note Submitter: michi at NONOSPAM michianimations dot de
----
The function by marc at grue dot info doesn't work properly with every year. Here is a better
one, which adapts to ISO-8601. It can compute a timestamp by a given $year and $week of that $year:
function week_to_time($week, $year, $day = 0){
return mktime(0, 0, 0, 1, 4 - date('w', (mktime(0, 0, 0, 1, 4, $year) -
1)) + $day, $year) + 604800 * ($week - 1);
}