Edit report at https://bugs.php.net/bug.php?id=63970&edit=1

 ID:                 63970
 User updated by:    obibann at hotmail dot com
 Reported by:        obibann at hotmail dot com
 Summary:            Wrong year on week calculation from 2012-12-30
 Status:             Open
 Type:               Bug
 Package:            Date/time related
 Operating System:   RedHat EL 6.2
 PHP Version:        5.3.20
 Block user comment: N
 Private report:     N

 New Comment:

Erratum :

I think it should return "201152"


Previous Comments:
------------------------------------------------------------------------
[2013-01-11 16:31:28] obibann at hotmail dot com

Description:
------------
Set your server on December 30 2012:

date -s "20121230 11:00"

Ask PHP to give you the year and week 52 weeks ago thanks to the code below.
PHP prints "201252" instead of "201201"
No problems from other dates of with another value of week.

Test script:
---------------
date_default_timezone_set("Your/Timezone"); // For me Europe/Paris
echo date("YW",strtotime("-52 week"));

Expected result:
----------------
201201

Actual result:
--------------
201252


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=63970&edit=1

Reply via email to