Can figure out whats wrong

From: Date: Thu, 03 Nov 2005 19:07:46 +0000
Subject: Can figure out whats wrong
Groups: php.general 
Request: Send a blank email to php-general+get-225065@lists.php.net to get a copy of this message
I have I strange problem /bug in my function and I hoping someone can tell me whats wrong. This function return the timestamp for midnight Monday on the given week number. Its working fine, but on week 44 and week 45 it misses with 3600 seconds (1 hour) I wounder if it's a bug in strtotime() or it something I'm doing, it only week 44 and 45. I hope someone can give me an answer on this problem. function week2Timestamp ($weekno) { $first_day_of_year = date('w', mktime(0,0,0,1,1, date('Y'))); if ($first_day_of_year == 0) { $first_day_of_year = 7; } $day = ($weekno -1) * 7 + 1 - $first_day_of_year; $timestamp = strtotime('next Monday', mktime(0, 0, 0, 1, $day, date('Y'))); return $timestamp; } - Anders

« previous php.general (#225065) next »