DateTime::Calendar::Christian - Dates in the Christian calendar
use DateTime::Calendar::Christian; $dt = DateTime::Calendar::Christian->new( year => 1752, month => 10, day => 4, reform_date => $datetime );
DateTime::Calendar::Christian is the implementation of the combined Julian and Gregorian calendar.
See DateTime for information about most of the methods.
The Julian calendar, introduced in Roman times, had an average year length of 365.25 days, about 0.03 days more than the correct number. When this difference had cummulated to about ten days, the calendar was reformed by pope Gregory XIII, who introduced a new leap year rule. To correct for the error that had built up over the centuries, ten days were skipped in October 1582. In most countries, the change date was later than that; England went Gregorian in 1752, and Russia didn't change over until 1918.
This manpage only describes those methods that differ from those of DateTime. See DateTime for all other methods.
Besides the usual parameters ("year", "month", "day", "hour", "minute", "second", "nanosecond", "fractional_seconds", "language" and "time_zone"), this class method takes the additional "reform_date" parameter. This parameter can be a DateTime object (or an object that can be converted into a DateTime). This denotes the first date of the Gregorian calendar. It can also be a string, containing the name of a location, e.g. 'Italy'.
If this method is used as an instance method and no "reform_date" is given, the "reform_date" of the returned object is the same as the one of the object used to call this constructor. This means you can make "date generators", that implement a calendar with a fixed reform date:
$english_calendar = DateTime::Calendar::Christian( reform_date => DateTime->new( year => 1752, month => 9, day => 14 ) );
$english_calendar = DateTime::Calendar::Christian( reform_date => 'UK' );
You can use this generator to create dates with the given reform_date:
$born = $english_calendar->new( year => 1732, month => 2, day => 22 ); $died = $english_calendar->new( year => 1799, month => 12, day => 14 );
When a date is given that was skipped during a calendar reform, it is assumed that it is a Gregorian date, which is then converted to the corresponding Julian date. This behaviour may change in future versions. If a date is given that can be both Julian and Gregorian, it will be considered Julian. This is a bug.
This method accepts an additional "reform_date" argument. Note that the epoch is defined for most (all?) systems as a date in the Gregorian calendar.
Returns the date of the calendar reform, as a DateTime object.
Return true or false indicating whether the datetime object is in a specific calendar.
This method returns a true or false indicating whether or not the datetime object is in a leap year. If the object is in the year of the date reform, this method indicates whether there is a leap day in that year, irrespective of whether the datetime object is in the same calendar as the possible leap day.
Returns the number of days in the year. Is equal to 365 or 366, except for the year(s) of the calendar reform.
This method returns the difference in days between the Gregorian and the Julian calendar. If the parameter $datetime is given, it will be used to calculate the result; in this case this method can be used as a class method.
Support for this module is provided via the email@example.com email list. See http://lists.perl.org/ for more details.
Eugene van der Pijll <firstname.lastname@example.org>
Copyright (c) 2003 Eugene van der Pijll. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
email@example.com mailing list