Last modified: 2013-05-29 06:46:21 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T50907, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 48907 - PHP outputs wrong day of the week for dates until 1600
PHP outputs wrong day of the week for dates until 1600
Status: NEW
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.22.0
All All
: Low minor (vote)
: ---
Assigned To: Nobody - You can work on this!
: upstream
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-28 19:05 UTC by Paul Robinson
Modified: 2013-05-29 06:46 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Paul Robinson 2013-05-28 19:05:15 UTC
Not sure if this is a wikimedia error or a PHP error. The day of week for 1/1/1600 is correct as Saturday. The day of week for 1-1-1599 is incorrect as Friday.

Place the following in any wikipedia page:

Today: 2013-05-28 is  {{#time:l|2013-05-28}},
, 2013 is {{#time:l|2013-01-01}}
, 1901 is {{#time:l|1901-01-01}}
, 1900 is {{#time:l|1900-01-01}}
, 1601 is {{#time:l|1601-01-01}}
, 1600 is {{#time:l|1600-01-01}}.<br>
Year 1599 is {{#time:l|1599-01-01}}
, 1598 is {{#time:l|1598-01-01}}
, 1597 is {{#time:l|1597-01-01}}
, 1596 is {{#time:l|1596-01-01}}
, 1595 is {{#time:l|1595-01-01}}
, 1594 is {{#time:l|1594-01-01}}
, 1593 is {{#time:l|1593-01-01}}.<br/>

--
This returns:

Today: 2013-05-28 is Tuesday, , 2013 is Tuesday , 1901 is Tuesday , 1900 is Monday , 1601 is Monday , 1600 is Saturday.
Year 1599 is Saturday , 1598 is Friday , 1597 is Thursday , 1596 is Tuesday , 1595 is Monday , 1594 is Sunday , 1593 is Saturday.


--
This is correct for today, 2013, 1901 and 1900.
This is correct for 1600 and 1601. This is incorrect for 1599 and I'm not sure how far back. 1599 started on a Friday, 1598 on a Thursday, 1597 on Wednesday, 1596 on Monday, 1595 on Sunday, etc. Oh, and it's not Julian/Gregorian error, these are Gregorian days.

I did this on an old automatically erased test template, the old revision of which can be viewed here:

http://en.wikipedia.org/w/index.php?title=Template:X8&oldid=557212409

Wikimedia version is 1.22 wmf 4, as running on en.wikipedia.org as of today, 5/28/13.
Comment 1 Paul Robinson 2013-05-28 19:07:30 UTC
Correction, I said, "The day of week for 1-1-1599 is incorrect as
Friday." this should read, "The day of week for 1-1-1599 is incorrect as it should be Friday."
Comment 2 Paul Robinson 2013-05-28 19:24:01 UTC
Confirmed, this is not a Wikimedia bug, this is a bug in php:

<?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>";
 ?>

Results:

January 01st, 1600 is on a Saturday
January 01st, 1599 is on a Saturday
Comment 3 Alex Monk 2013-05-28 19:49:36 UTC
You may want to read https://www.mediawiki.org/wiki/Wikipmediawiki
Comment 4 Paul Robinson 2013-05-28 20:08:34 UTC
This bug has been reported to PHP.NET, the bug number is 61599

https://bugs.php.net/bug.php?id=61599

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links