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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to