php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50744 Missing days in Sept 1752
Submitted: 2010-01-14 08:03 UTC Modified: 2010-01-14 10:32 UTC
From: nuke at psu dot edu Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.3SVN-2010-01-14 (snap) OS: *
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nuke at psu dot edu
New email:
PHP Version: OS:

 

 [2010-01-14 08:03 UTC] nuke at psu dot edu
Description:
------------
In ext/date/lib/interval.c around line 58, there should be a flag to 
test for years before, say, 1753, and throw a warning for people to use 
the Calendar functions, assuming those functions are doing it correctly.

I'd check the Calendar functions today, esp. GregoriantoJD, except that 
it's already 3am here.  Besides, that'd be a different test.

Here's one webpage about the issue I found in 1752:
http://www.genealogytoday.com/columns/everyday/030902.html



Reproduce code:
---------------
$one = new DateTime("1752-09-02 00:00:00"); 
$two = new DateTime("1752-09-14 00:00:00");
$diff = $one->diff($two);
echo $diff->days."=1"; 


Expected result:
----------------
1=1

Actual result:
--------------
12=1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-14 10:32 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

PHP implements the ISO 8601 calendar (which is a proleptic Gregorian calendar with modifications for the year 0, see http://en.wikipedia.org/wiki/Gregorian_calendar#Proleptic_Gregorian_calendar and http://en.wikipedia.org/wiki/ISO_8601#Dates).

The reason is that the switch over from the Julian calendar to the Gregorian calendar wasn't in 1752 for every locality (see http://en.wikipedia.org/wiki/Gregorian_calendar#Timeline) If I were to implement this correctly, then you would have to set in which locality the calendar was used. I would also have to add support for very specific rules for for example Sweden which messed up and required a February 30th at one point: See the 5th and 6th paragraph of http://en.wikipedia.org/wiki/Gregorian_calendar#Adoption_in_Europe
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 09 13:01:36 2025 UTC