#21572 [Fbk->Opn]: date gives 0 as a week number of year

From: Date: Fri, 10 Jan 2003 22:40:26 +0000
Subject: #21572 [Fbk->Opn]: date gives 0 as a week number of year
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-29728@lists.php.net to get a copy of this message
ID: 21572 User updated by: trio@surffi.saunalahti.fi Reported By: trio@surffi.saunalahti.fi -Status: Feedback +Status: Open Bug Type: Date/time related Operating System: Redhat 8.0 PHP Version: 4.2.2 New Comment: 1) I have not that kind of platform to use right know. 2) I am GMT +02:00 timezone. Previous Comments: ------------------------------------------------------------------------ [2003-01-10 16:34:37] pollita@php.net Unable to reproduce with script given, output of date("W") is always >= 1 and <= 53. (1) Could you try it with 4.3.0 and see if you get the same results? (2) What timezone are you in? ------------------------------------------------------------------------ [2003-01-10 16:14:17] trio@surffi.saunalahti.fi I found out that date("W", $stamp) can gives a zero as output. <?php $stamp = time(); while( date("W", $stamp ) != 0 ) $stamp+=5000; print date( "d.m.Y H:i W", $stamp ) . " $stamp\n"; ?> Out could be for examble "01.01.2005 00:46 0 1104533193". I check the ISO-8601 standard (version 2000-12-19 ISO/TC 154 N 362) and it says: calendar week is represented by two decimal digits. The first calendar week of a year shall be identified as [01] and subsequent weeks shall be numbered in ascending sequence. Futhermore the date function should have a option for 'normally' week number of the year like most of people does it understand practically: 1.1.xxxx is 1 and so on and finally 31.12.xxxx is 52. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21572&edit=1

« previous php.bugs (#29728) next »