ID: 43849 Updated by: [EMAIL PROTECTED] Reported By: kiange at gmail dot com -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Ubuntu PHP Version: 5.2.5 New Comment:
This is correct, the "W" shows the ISO week, which you need to match against the ISO year specifier ("o" - small "O"). ISO Week 2008-01 goes from Dec 31st to Jan 6th. This will return what you expect: echo date('Yo', strtotime('2007-12-31')), "\n"; strftime() would not be good to rely on, as the output might differ on other operating systems. Previous Comments: ------------------------------------------------------------------------ [2008-01-15 06:18:31] kiange at gmail dot com Description: ------------ Enviornments: PHP 5.2.3-1ubuntu6.2 Reproduce code: --------------- echo date('YW', strtotime('2007-12-31')); // return 200701, maybe 200801 according to the reference page echo strftime("%Y%W",strtotime("2007-12-31")); // return 200753 Expected result: ---------------- 200753 or 200801 Actual result: -------------- 200701 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43849&edit=1