note 27817 deleted from function.strftime by sniper

From: Date: Wed, 15 Jan 2003 09:35:01 +0000
Subject: note 27817 deleted from function.strftime by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-42160@lists.php.net to get a copy of this message
Some other user wrote: "Windows users cannot use the %V specifier for strftime as it is not implemented in the OS. Following is a possible workaround to get the ISO weeknumber: function ISOWeek($y, $m, $d) { $week=strftime("%W", mktime(0, 0, 0, $m, $d, $y)); $dow0101=getdate(mktime(0, 0, 0, 1, 1, $y)); if ($dow0101["wday"]>1 && $dow0101["wday"]<5) $week++; elseif ($week==0) $week=53; return(substr("00" . $week, -2)); }" This function, however, does not take into concideration that a week starts on monday and not sunday according to that ISO-standard. Also for weeks having Jan 1 as later than Thursday the week number is not 1 but the number of the last week in the previous year. I´m working on a solution.

« previous php.notes (#42160) next »