note 27817 added to function.strftime

From: Date: Thu, 19 Dec 2002 20:06:39 +0000
Subject: note 27817 added to function.strftime
Groups: php.notes 
Request: Send a blank email to php-notes+get-41130@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. -- http://www.php.net/manual/en/function.strftime.php http://master.php.net/manage/user-notes.php?action=edit+27817 http://master.php.net/manage/user-notes.php?action=delete+27817 http://master.php.net/manage/user-notes.php?action=reject+27817

« previous php.notes (#41130) next »