#33957 [NEW]: gmdate('W')/date('W') sometimes returns wrong week number.
From: paul at stunning-stuff dot com
Operating system: Windows XP Pro
PHP version: 5.1.0b3
PHP Bug Type: Date/time related
Bug description: gmdate('W')/date('W') sometimes returns wrong week number.
Description:
------------
Hi,
While I was writing my own getWeekNumber method I discovered gmdate('W')
and date('W') both return incorrect results for the year 1992 and 2020.
Both years end on a thursday and both are leap years. I'm guessing that
this is exactly the reason they return incorrect results :).
Expected result:
The last 4 days in 1992 and 2020 belong to week 53 of those years
according to ISO 8601 rules.
Actual result:
gmdate('W') and date('W') think the last 4 days of 1992 and 2020 belong to
week 1 of the following year.
I only had the time to test these two years, but I expect that PHP will
return the incorrect week number for every leap year that ends with a
thursday.
Thanks,
Paul van der Maas
---
www.stunning-stuff.com
--
Edit bug report at http://bugs.php.net/?id=33957&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33957&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33957&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33957&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33957&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33957&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33957&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33957&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33957&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33957&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33957&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33957&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33957&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33957&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33957&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33957&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33957&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33957&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33957&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33957&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33957&r=mysqlcfg
Thread (11 messages)
- paul at stunning-stuff dot com
- sniper@php.net#33957 [Opn->Fbk]: gmdate('W')/date('W') sometimes returns wrong week number.
- paul at stunning-stuff dot com#33957 [Fbk->Opn]: gmdate('W')/date('W') sometimes returns wrong week number.
- derick@php.net#33957 [Opn->Asn]: gmdate('W')/date('W') sometimes returns wrong week number.
- paul at stunning-stuff dot com#33957 [Asn]: gmdate('W')/date('W') sometimes returns wrong week number.
- derick@php.net#33957 [Asn->Csd]: gmdate('W')/date('W') sometimes returns wrong week number.
- wps at wwe dot comBug #33957 [Com]: gmdate('W')/date('W') sometimes returns wrong week number.
- paul at stunning-stuff dot comBug #33957 [Csd]: gmdate('W')/date('W') sometimes returns wrong week number.
- cgullz at gmail dot comBug #33957 [Com]: gmdate('W')/date('W') sometimes returns wrong week number.
- paul at stunning-stuff dot comBug #33957 [Com]: gmdate('W')/date('W') sometimes returns wrong week number.
- tchorbadjiiski at gmail dot comBug #33957 [Com]: gmdate('W')/date('W') sometimes returns wrong week number.