note 35046 added to function.mktime
| From: | michi at rack1 dot php dot net | Date: | Sun, 17 Aug 2003 23:12:18 +0000 |
| Subject: | note 35046 added to function.mktime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-54544@lists.php.net to get a copy of this message | ||
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){
return mktime(0, 0, 0, 1, 4 - date("w", (mktime(0, 0, 0, 1, 4, $year) - 1)), $year) +
604800 * ($week - 1) - 3600;
}
----
Manual Page -- http://www.php.net/manual/en/function.mktime.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35046
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35046&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35046&report=yes