Problems with date()

From: Date: Wed, 13 Sep 2006 16:38:26 +0000
Subject: Problems with date()
Groups: php.general 
Request: Send a blank email to php-general+get-241730@lists.php.net to get a copy of this message
I hope someone can help with this. I'm trying to find the week number of the last week of the year. I have the following code snippet: $lastday = strtotime("31 December ".$year); $lastdate = date("Y-m-d", $lastday); // for testing $lastweek = date(W, $lastday); I put the $lastdate line in because I was convinced that $lastday must be wrong, but it's correct! When $year is 2000 I get an expected $lastweek of 52. When $year is 2001, 2002, or 2003 the $lastweek is 01! When $year is 2004 $lastweek is 53. When $year is 2005 $lastweek is 52. I haven't checked further than 2005. Why do I get the weird lastweek values for 2001, 2002, and 2003? I'm using PHP 4.3.4 on Win2000. Arno

« previous php.general (#241730) next »