Bug #61599 [Com]: Wrong Day of Week
Edit report at https://bugs.php.net/bug.php?id=61599&edit=1
ID: 61599
Comment by: zhanglijiu at gmail dot com
Reported by: grom358_spamkill at yahoo dot com dot au
Summary: Wrong Day of Week
Status: Open
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 5.3.10
Block user comment: N
Private report: N
New Comment:
According to your code,my results is "Saturday, 15th October 1582 Saturday, 31st
December 1599", there is nothing wrong.
My system is Mac 10.6.8 PHP 5.3.1
Previous Comments:
------------------------------------------------------------------------
[2012-04-02 06:08:04] grom358_spamkill at yahoo dot com dot au
Description:
------------
The 15th October 1582 is a Friday (see
http://en.wikipedia.org/wiki/Gregorian_calendar).
Testing with Python and Java
confirms this as well. Also checked the Gnome calendar.
The Proleptic Gregorian Calendar (see
http://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar)
just extends the
Gregorian calendar backwards. I'm assuming PHP is using proleptic calendar, which
would make 4th october 1582 a monday. But again DateTime gets it wrong.
I made a script to find the breaking point, and it occurs at 31st December 1599.
It returns it as a Saturday when in fact its a Friday.
Test script:
---------------
<?php
$date = new DateTime();
$date->setDate(1582, 10, 15);
echo $date->format('l, jS F Y') . PHP_EOL;
$date->setDate(1599, 12, 31);
echo $date->format('l, jS F Y') . PHP_EOL;
Expected result:
----------------
Friday, 15th October 1582
Friday, 31st December 1599
Actual result:
--------------
Saturday, 15th October 1582
Saturday, 31st December 1599
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=61599&edit=1
Thread (7 messages)