Bug #61599 [Opn->Csd]: Wrong Day of Week

From: Date: Thu, 28 Nov 2013 16:35:03 +0000
Subject: Bug #61599 [Opn->Csd]: Wrong Day of Week
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182994@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61599&edit=1 ID: 61599 Updated by: derick@php.net Reported by: grom358_spamkill at yahoo dot com dot au Summary: Wrong Day of Week -Status: Open +Status: Closed Type: Bug Package: Date/time related Operating System: Linux PHP Version: 5.3.10 -Assigned To: +Assigned To: derick Block user comment: N Private report: N New Comment: The fix for this bug has been committed. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2013-05-28 19:50:43] paul at paul-robinson dot us This was reported (in error) to Wikimedia for their Wikipedia software, the bug number is 48907: https://bugzilla.wikimedia.org/show_bug.cgi?id=48907 ------------------------------------------------------------------------ [2013-05-28 19:47:06] paul at paul-robinson dot us I can confirm this bug, which I originally thought was in Wikimedia. <?php $h = mktime(0, 0, 0, 1, 1, 1600); $d = date("F dS, Y", $h) ; $w= date("l", $h) ; Echo "$d is on a $w<br>"; $h = mktime(0, 0, 0, 1, 1, 1599); $d = date("F dS, Y", $h) ; $w= date("l", $h) ; Echo "$d is on a $w<br>"; ?> Returns: January 01st, 1600 is on a Saturday January 01st, 1599 is on a Saturday January 1, 1599 was a Friday. I did a few other tests for Wikimedia, you can see how they show up there. http://en.wikipedia.org/w/index.php?title=Template:X8&oldid=557212409 Another version: <?php $h = mktime(0, 0, 0, 5, 28, 2013); $d = date("F dS, Y", $h) ; $w= date("l", $h) ; Echo "$d is on a $w, "; $h = mktime(0, 0, 0, 1, 1, 2013); $d = date("F dS, Y", $h) ; $w= date("l", $h) ; Echo "$d is on a $w, "; $h = mktime(0, 0, 0, 1, 1, 1901); $d = date("F dS, Y", $h) ; $w= date("l", $h) ; Echo "$d is on a $w, "; $h = mktime(0, 0, 0, 1, 1, 1900); $d = date("F dS, Y", $h) ; $w= date("l", $h) ; Echo "$d is on a $w, "; $h = mktime(0, 0, 0, 1, 1, 1601); $d = date("F dS, Y", $h) ; $w= date("l", $h) ; Echo "$d is on a $w, "; $h = mktime(0, 0, 0, 1, 1, 1600); $d = date("F dS, Y", $h) ; $w= date("l", $h) ; Echo "$d is on a $w<br>"; $h = mktime(0, 0, 0, 1, 1, 1599); $d = date("F dS, Y", $h) ; $w= date("l", $h) ; Echo "$d is on a $w, "; $h = mktime(0, 0, 0, 1, 1, 1598); $d = date("F dS, Y", $h) ; $w= date("l", $h) ; Echo "$d is on a $w<br>"; ?> Results: May 28th, 2013 is on a Tuesday, January 01st, 2013 is on a Tuesday, January 01st, 1901 is on a Tuesday, January 01st, 1900 is on a Monday, January 01st, 1601 is on a Monday, January 01st, 1600 is on a Saturday January 01st, 1599 is on a Saturday, January 01st, 1598 is on a Friday Today, 2013, 1901, 1900, 1601 and 1600 are correct. 1599 and 1598 are incorrect. 1599 was a Friday, 1598 was a Thursday. ------------------------------------------------------------------------ [2012-05-13 22:29:02] grom358_spamkill at yahoo dot com dot au Just to make it clearer, run the following: <?php $date = new DateTime(); $date->setDate(1599, 12, 31); echo $date->format('l, jS F Y') . PHP_EOL; $date->setDate(1600, 1, 1); echo $date->format('l, jS F Y') . PHP_EOL; You will see there is two saturdays in a row :O ------------------------------------------------------------------------ [2012-05-12 23:57:26] grom358_spamkill at yahoo dot com dot au @zhanglijiu it should return Friday so your results confirm this bug ------------------------------------------------------------------------ [2012-05-11 15:54:22] zhanglijiu at gmail dot com 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 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=61599 -- Edit this bug report at https://bugs.php.net/bug.php?id=61599&edit=1

« previous php.bugs (#182994) next »