view release on metacpan or search on metacpan
lib/Date/Korean.pm view on Meta::CPAN
        }
        else {
            croak "Invalid date.";
        }
    }
    # solar 1582-10-15 -> cjd:2299161 ,After this are gregorian calendar range.
    if ( $days < 2299161 ) {  # julian calendar range
        # gregorian 1582-10~05 ~ 1582-10-14 dates do not exist.
        if ( $year==1582 && $month==10 && $day>=5 && $day<=14) {
            croak "The gregorian date does not exist\n";
        }
        $days = DateTime::Calendar::Julian
lib/Date/Korean.pm view on Meta::CPAN
    # get ganzi in korean
    my ($saecha, $wolgun, $iljin) = get_ganzi_ko(2008, 9, 12, 0);
=head1 DESCRIPTION
The traditional korean lunisolar calendar is based on the chinese calendar. This module handles conversion between Korean solar and lunisolar date.
=head1 FUNCTIONS
=over 4
view release on metacpan or search on metacpan
lib/Date/Lectionary/Daily.pm view on Meta::CPAN
The Time::Piece object date of the day you woudl like the lessons for.
=head3 lectionary
One of two choices `acna-sec` for the new secular calendar based ACNA daily lectionary or `acna-xian` for the previous liturgically-based ACNA daily lectionary.
If lectionary is not given at construction, the ACNA secular daily lectionary â `acna-sec` â will be used.
=head2 ATTRIBUTES
lib/Date/Lectionary/Daily.pm view on Meta::CPAN
Presently only returns `acna`.  Future version of the module may include daily lectionary from other traditions.
=head3 type
Returns `secular` for daily lectionaries based on the secular/civil calendar and `liturgical` for daily lectionaries based on the liturgical calendar.
=head3 readings
A hasref of the readings for the day.
lib/Date/Lectionary/Daily.pm view on Meta::CPAN
}
=head2 _buildType
Private method to determine if the daily lectionary follows the secular calendar or the liturgical calendar.
=cut
sub _buildType {
    my $lectionary = shift;
lib/Date/Lectionary/Daily.pm view on Meta::CPAN
    return 0;
}
=head2 _buildReadingsLiturgical
Private method that returns an ArrayRef of strings for the lectionary readings associated with the date according to the liturgical calendar.
=cut
sub _buildReadingsLiturgical {
    my $weekName   = shift;
lib/Date/Lectionary/Daily.pm view on Meta::CPAN
    return \%readings;
}
=head2 _buildReadingsSecular
Private method that returns an ArrayRef of strings for the lectionary readings associated with the date according to the secular calendar.
=cut
sub _buildReadingsSecular {
    my $weekName   = shift;
view release on metacpan or search on metacpan
lib/Date/Lectionary.pm view on Meta::CPAN
    use Time::Piece;
    use Date::Lectionary;
    my $epiphany = Date::Lectionary->new('date'=>Time::Piece->strptime("2017-01-06", "%Y-%m-%d"));
    say $epiphany->day->name; #String representation of the name of the day in the liturgical calendar; e.g. 'The Epiphany'
    say $epiphany->year->name; #String representation of the name of the liturgical year; e.g. 'A'
    say ${$epiphany->readings}[0] #String representation of the first reading for the day.
=head1 DESCRIPTION
view release on metacpan or search on metacpan
lib/Date/MSD.pm view on Meta::CPAN
    # and 69 other conversion functions
=head1 DESCRIPTION
For date and time calculations it is convenient to represent dates by
a simple linear count of days, rather than in a particular calendar.
This module performs conversions between different flavours of linear
count of Martian solar days ("sols").
Among Martian day count systems there are also some non-trivial
differences of concept.  There are systems that count only complete days,
lib/Date/MSD.pm view on Meta::CPAN
This quantity naming pattern is derived from the naming of Terran day
counts, particularly JD (Julian Date) and JDN (Julian Day Number) which
have the described correspondence.  The "XYZF" name type is a neologism,
invented for L<Date::JD>.
All calendar dates given are in the Darian calendar for Mars.  An hour
number is appended to each date, separated by a "T"; hour 00 is midnight
at the start of the day.  An appended "Z" indicates that the date is to
be interpreted in the timezone of the prime meridian (Airy Mean Time),
and so is absolute; where any other timezone is to be used then this is
explicitly noted.
lib/Date/MSD.pm view on Meta::CPAN
days elapsed since 0000-01-01T00Z (MSD -94129.0) (approximately
MJD -91195.22 in Terrestrial Time).  This epoch is an Airy
midnight approximating the last northward equinox prior to
the first telescopic observations of Mars.  The same epoch is
used for the Darian calendar for Mars.  JS is defined (but not
explicitly) by the document describing the Darian calendar, at
L<http://pweb.jps.net/~tgangale/mars/converter/calendar_clock.htm>.
=item CMSD (Chronological Mars Solar Date)
days elapsed since -0608-23-20T00 in the timezone of interest.
CMSD = MSD + 500000.0 + Zoff, where Zoff is the timezone
view release on metacpan or search on metacpan
internal/data.misc.pl view on Meta::CPAN
# The following zone(s) will not use a LAST RULE to calculate time zone
# changes past $keep_year. Instead, they will use all dates from a dump,
# and nothing beyond that.
#
# Asia/Jerusalem uses a non-standard way based on the Hebrew calendar.
%no_last = map { $_,1 } qw(Asia/Jerusalem Asia/Tehran);
1;
view release on metacpan or search on metacpan
lib/Date/Maya.pm view on Meta::CPAN
    my ($long, $tzolkin, $haab) = julian_to_maya 2451432;
    my  $julian                 = maya_to_julian '12.19.6.9.9';
=head1 DESCRIPTION
For an extensive description of both the Maya calendar and Julian days,
see the calendar faq [1].
This module presents routines to calculate the Mayan day from a Julian
day, and a Julian day from a Mayan day. The Mayan calendar has different
dating systems, the Long Count (which cycles every 5125 years), the
Tzolkin (260 days) and the Haab (365 days). The Long Count consists
of quintuple of numbers (really a mixed base 20/18 number), while the
Tzolkin and the Haab consist of day numbers and week or month names. In
the Tzolkin, both the week number and week name change from day to day;
lib/Date/Maya.pm view on Meta::CPAN
the Long Count date, the Tzolkin date, and the Haab date. C<maya_to_julian>
takes a Long Count date as argument, and returns a Julian day.
=head2 EPOCH AND ROLL OVER
It is unclear when the epoch of the Mayan calendar occurred. Three dates
are mentioned as candidates, S<13 Aug 3114 BC>, S<11 Aug 3114 BC>, and
S<15 Oct 3374 BC>. Unless changed, this module assumes S<13 Aug 3114> as
the epoch.
To change the epoch, import the function C<maya_epoch>, and call it with the
Julian date that should be the epoch. Constants C<MAYA_EPOCH1>, C<MAYA_EPOCH2>
and C<MAYA_EPOCH3> can be imported, which will have the Julian days for
S<13 Aug 3114 BC>, S<11 Aug 3114 BC>, and S<15 Oct 3374 BC> as values.
The three constants can be imported at once by using the C<:MAYA_EPOCH> tag.
The Mayan calendar is cyclic, with a period of just over 5125 years. This
means that if the epoch was in S<Aug 3114 BC>, the calendar will roll over
in S<Dec 2012 AD>. If the epoch was in S<3374 BC>, the roll over has occured
over 200 years ago. Since the calendar is cyclic, the C<maya_to_julian> function
is not unique. We will however return only one date, and that is the first
Julian day matching the Long Count date on or after the choosen epoch.
The Mayan Long Count calendar rolls over after 1872000 days.
=head1 REFERENCES
=over 4
=item [1]
Tondering, Claus: I<FREQUENTLY ASKED QUESTIONS ABOUT CALENDARS>
L<< http://www.tondering.dk/claus/calendar.html >>
=back
=head1 SEE ALSO
view release on metacpan or search on metacpan
lib/Date/Namedays/Simple.pm view on Meta::CPAN
# years are not taken into consideration!
###########################################################
sub getNames {
        my ($self, $month, $day, $year) = @_;
	# some calendars handle leap-years in a special way... like
	# the Hungarian, which is totally insane
	my $leapyearmonth = 0;
	my $leapyearmonth = 1 if ($year && (not ($year % 4) ) && ($month == 2));	
	# note: this is a VERY lame leap-year calculation here...
	
view release on metacpan or search on metacpan
lib/Date/Object.pm view on Meta::CPAN
    }
    
    return undef ;
  }
  
  # The Egyptians called it 365 and left it at that. But their calendar got out of step with the seasons, so that 
  # after around 750 years of this they were celebrating The Fourth of July in the middle of the winter.
  # 
  # The Romans wised up and added the leap day every four years to get the 365.25 day Julian year. Much better, 
  # but notice that this time the year is longer than it ought to be. The small difference between this and the 
  # true length of the year caused the seasons to creep through the calendar once again, only slower and in the 
  # other direction. After about 23000 years of this, July Fourth would once again fall in mid-winter.
  # 
  # Fortunately things never reached that sad state. By 1582 the calendar was about ten days out of whack, so 
  # Pope Gregory XIII included the correction that's still in use today. 
  # 
  # "If the year is divisible by 100, it's not a leap year UNLESS it is also divisible by 400."
  # 
  # More recently, proposals for fixes have gotten even better than that. One suggested change is to add on "if 
lib/Date/Object.pm view on Meta::CPAN
__END__
=head1 NAME
Date::Object - Handles dates/calendars/timezones and it's representation/convertions using a single Date::Object.
=head1 DESCRIPTION
Date::Object is an alternative to the L<DateTime> modules, with the main pourpose
to handle dates using a single object or make multiple I<Date::Object>s work together
view release on metacpan or search on metacpan
Pcalendar.pm view on Meta::CPAN
##    This package is free software; you can redistribute it                 ##
##    and/or modify it under the same terms as Perl itself.                  ##
##                                                                           ##
###############################################################################
package Date::Pcalendar;
BEGIN { eval { require bytes; }; }
use strict;
use vars qw( @ISA @EXPORT @EXPORT_OK $VERSION );
Pcalendar.pm view on Meta::CPAN
$VERSION = '6.1';
use Carp::Clan qw(^Date::);
use Date::Pcalc::Object qw(:ALL);
use Date::Pcalendar::Year qw( check_year empty_period );
sub new
{
    my($class)    = shift;
    my($profile)  = shift;
    my($language) = shift || 0;
    my($self);
    $self = [ ];
    $class = ref($class) || $class || 'Date::Pcalendar';
    bless($self, $class);
    $self->[0] = { };
    $self->[1] = $profile;
    $self->[2] = $language;
    $self->[3] = [@_];
Pcalendar.pm view on Meta::CPAN
        return $self->[0]{$year};
    }
    else
    {
        return $self->[0]{$year} =
            Date::Pcalendar::Year->new( $year, $self->[1], $self->[2], @{$self->[3]} );
    }
}
sub cache_keys
{
view release on metacpan or search on metacpan
0.13  Fri Aug 05 14:45:00 2016
      - Updated the dependency on Date::Utils v0.21.
0.12  Sat Jul 23 12:00:00 2016
      - Updated the dependency on Date::Utils v0.20.
      - Dropped method get_calendar() as it's no longer relevant here.
0.11  Wed Jun 29 11:15:00 2016
      - Addressed issue raised in the CPAN Tester Report.
        http://www.cpantesters.org/cpan/report/5d3ad818-3d02-11e6-a5ff-abe4273a1f7f
      - Renamed method get_days_in_persian_month_year() to days_in_month_year().
      - Updated unit test to respect the above change.
0.09  Thu May 19 10:15:00 2016
      - Updated the dependency on Date::Utils v0.19.
      - Updated method get_calendar() and method as_string() to use get_month_name().
      - Renamed method persian_months() to months().
      - Renamed method persian_days() to days().
      - Updated method get_calendar() to respect the above changes.
0.08  Tue Apr 26 10:35:00 2016
      - Updated the dependency on Date::Utils v0.16.
      - Added $AUTHORITY.
      - Added section "SEE ALSO".
0.07  Wed Aug 26 09:35:00 2015
      - Added the dependency on Date::Utils v0.11.
0.06  Sat Jul 18 07:45:00 2015
      - Added the dependency on Date::Utils v0.10.
      - Added method get_calendar().
0.05  Sun Jul 05 17:50:00 2015
      - Added the dependency on Date::Utils v0.09.
0.04  Fri Jun 26 14:45:00 2015
view release on metacpan or search on metacpan
lib/Date/Piece.pm view on Meta::CPAN
This is useful for constructs such as "tomorrow", "yesterday", "this
time tomorrow", "one week from today", "one month later", "my 31st
birthday", and various other not-necessarily-numeric intervals on the
arbitrary and edge-case-laden division of time known by most earthlings
as "the calendar."  That is, adding days or months is analogous to
counting squares or turning pages on a calendar.
This module extends Date::Simple and connects it to Time::Piece.  See
Date::Simple for more details.
=head1 Immutable
lib/Date/Piece.pm view on Meta::CPAN
=head1 Fuzzy Math
We can do math with months and years as long as you're flexible about
the day of the month.  The theme here is to keep the answer within the
destination calendar month rather than adding e.g. 30 days.
=head2 adjust_day_of_month
Returns a valid date even if the given day is beyond the last day of the
month (returns the last day of that month.)
view release on metacpan or search on metacpan
examples/synopsis.pl view on Meta::CPAN
use warnings;
use strict;
use utf8;
use Date::Qreki ':all';
my @qreki = calc_kyureki (2017, 1, 31);
print "Old calendar $qreki[0] $qreki[2] $qreki[3]\n";
view release on metacpan or search on metacpan
lib/Date/Remind/Event.pm view on Meta::CPAN
  print 'Description: '. $e->body              ."\n";
=head1 DESCRIPTION
B<Date::Remind::Event> provides a Perl object interface to textual
events emitted by the L<remind>(1) calendar program. The expected
format of the input is the same as what is produced by "remind -s" (as
defined in the L<rem2ps>(1) manpage under "REM2PS INPUT FORMAT").
L<remind>(1) produces slightly different output depending on the value
of the -b flag. To make sure that Date::Remind::Event handles this
view release on metacpan or search on metacpan
lib/Date/Roman.pm view on Meta::CPAN
   <annus>      =  1*DIGIT
   <spaces>     =  1*WSP
We use the "b6" prefix to indicate the leap day (24th february)
introduced in leap tears. As it is stated below in section L<The days
in the Roman calendar>, this was again the 6th day before the Kalendae
of March, exatly as the day after.
=head2 The I<ical> format
The I<ical> format is a generalization of the format for dates defined
lib/Date/Roman.pm view on Meta::CPAN
=head1 THE ROMAN CALENDAR
=head2 The Julian reform, the month length
Julius Caesar made his famous calendar reform in S<45 BC>. According to
this reform, the year was of 365 days, divided in 12 months:
Ianuarius, 31 days; Februaarius, 28 days, Martius, 31 days; Aprilis,
30 days; Maius, 31 days, Iunius, 30 days, Iulius, 31 days; Sextilis 31
days, September, 30 days, October, 31 days; November, 30 days; and
December, 31 days. Later, Sextilis became Augustus (to simplify, we
lib/Date/Roman.pm view on Meta::CPAN
account the Gregorian reform assuming that it took place in 
S<1582 AD>. It does not take into account the problems in determining 
leap years between S<45 BC> and S<8 AD> (at least it does not yet, 
L<see the section TODO above|TODO>).
=head2 The days in the Roman calendar
The Romans didn't number the days sequentially from 1. Instead they
had three fixed days in each month: 
=over
lib/Date/Roman.pm view on Meta::CPAN
is the year S<2755 AUC> (ab Urbe condita, after the foundation 
of the City).
=head2 What before the Julian reform?
Before Julius Caesar introduced the Julian calendar in S<709 AUC>, the
Roman calendar was a mess, and much of our so-called ``knowledge''
about it seems to be little more than guesswork. This module uses the
Julian calendar also for dates before the 1 Jan S<45 BC> (or, more
precisely, Kalendas Ianuariis S<DCCIX AUC>). This is the so called
'proleptic Julian calendar' and it is consistent with the historians'
habit to do so.
=head1 AUTHOR
lib/Date/Roman.pm view on Meta::CPAN
=head2 Web
The very good Frequently Asked Questions about Calendars by Claus
Tondering. You can found it at 
http://www.tondering.dk/claus/calendar.html
See especially section 2.7.
=cut
view release on metacpan or search on metacpan
0.15  Sat Aug 06 11:45:00 2016
      - Updated the dependency on Date::Utils v0.21.
0.14  Sun Jul 24 08:50:00 2016
      - Updated the dependency on Date::Utils v0.20.
      - Dropped method get_calendar() as it's no longer relevant here.
0.13  Thu Jun 30 10:30:00 2016
      - Addressed issue raised in the CPAN Tester Report.
        http://www.cpantesters.org/cpan/report/48e6a3f6-3d02-11e6-a5ff-abe4273a1f7f
      - Refactored method days_in_chaitra() and days_in_month_year().
      - Added missing dependency on Date::Exception.
0.11  Fri May 20 10:30:00 2016
      - Updated the dependency on Date::Utils v0.19.
      - Updated method get_calendar() and method as_string() to use get_month_name().
      - Renamed method saka_months() to months().
      - Renamed method saka_days() to days().
      - Renamed method get_days_in_saka_month_year() to get_days_in_month_year().
      - Updated method get_calendar() to respect the above changes.
0.10  Sat Apr 23 13:20:00 2016
      - Updated the dependency on Date::Utils v0.16.
      - Added section "SEE ALSO".
      - Updated copyright year information.
        - add_years()
        - minus_years()
0.08  Mon Jul 20 11:45:00 2015
      - Added the dependency on Date::Utils v0.10.
      - Added method get_calendar().
0.07  Mon Jul 06 09:15:00 2015
      - Added the dependency on Date::Utils v0.09.
      - Tidied up pod document in general.
view release on metacpan or search on metacpan
lib/Date/Simple/Month.pm view on Meta::CPAN
    my @wraparound_dates_from_tuesday = $month->wraparound_dates(2);
=head1 DESCRIPTION
Date::Simple::Month is a subclass of Date::Range that represents a complete calendar month
consisted of Date::Simple objects.
=head1 METHOD
=head2 new
view release on metacpan or search on metacpan
lib/Date/Span.pm view on Meta::CPAN
#pod  print "from $_->[0] to $_->[1]\n" for (@spanned);
#pod
#pod =head1 DESCRIPTION
#pod
#pod This module provides code for dealing with datetime ranges that span multiple
#pod calendar days.  This is useful for computing, for example, the amount of
#pod seconds spent performing a task on each day.  Given the following table:
#pod
#pod   event   | begun            | ended
#pod  ---------+------------------+------------------
#pod   loading | 2004-01-01 00:00 | 2004-01-01 12:45
lib/Date/Span.pm view on Meta::CPAN
 print "from $_->[0] to $_->[1]\n" for (@spanned);
=head1 DESCRIPTION
This module provides code for dealing with datetime ranges that span multiple
calendar days.  This is useful for computing, for example, the amount of
seconds spent performing a task on each day.  Given the following table:
  event   | begun            | ended
 ---------+------------------+------------------
  loading | 2004-01-01 00:00 | 2004-01-01 12:45
view release on metacpan or search on metacpan
lib/Date/SundayLetter.pm view on Meta::CPAN
# sub parameter {{{
sub parameter {
# The "parameter" is a magic number that tracks how far the Gregorian
# calendar is from the Julian calendar. It has roughly to do with the
# fact that the Gregorian calendar observes leap year on the 4-century
# mark, and the Julian calendar does not.
    my $year = shift;
    my $S = int ($year / 100 );
    my $P = ( int( $S/4 ) - $S ) % 7;
view release on metacpan or search on metacpan
lib/Date/Tie.pm view on Meta::CPAN
=head1 DESCRIPTION
Date::Tie is an attempt to simplify date operations syntax.
It works with calendar dates (year-month-day), 
ordinal dates (year-day), week dates (year-week-day),
times (hour:minute:second), decimal fractions (decimal hours,
decimal minutes and decimal seconds), and time-zones. 
Whenever a Date::Tie hash key receives a new value, it will change 
lib/Date/Tie.pm view on Meta::CPAN
=item I<year>, I<month>, I<day> or I<monthday>, I<hour>, I<minute>, I<second>
These keys are just what they say. 
You can use B<I<monthday>> instead of I<day> if you want to make it clear
it is not a I<yearday> (ordinal calendar) or a I<weekday> (week calendar). 
=item I<yearday>, I<week>, I<weekday>, I<weekyear>
B<I<yearday>> is the day number in the year.
view release on metacpan or search on metacpan
inc/My/Module/Meta.pm view on Meta::CPAN
    bless $self, $class;
    return $self;
}
sub abstract {
    return 'Data functionality for Shire calendars.';
}
sub add_to_cleanup {
    return [ qw{ cover_db xt/author/optionals } ];
}
view release on metacpan or search on metacpan
lib/Date/Tolkien/Shire.pm view on Meta::CPAN
        year    => 1419,
        holiday => 3,
    );
This method sets the object's date to the given date in the Shire
calendar. The named arguments are C<year>, C<month>, C<day>, and
C<holiday>, and all are numeric. The C<year> argument is required; all
others are optional. You may not specify both C<month> and C<holiday>.
If C<month> is specified, C<day> defaults to C<1>; otherwise C<holiday>
defaults to C<1>.
lib/Date/Tolkien/Shire.pm view on Meta::CPAN
This is a re-implementation imported from
L<Date::Tolkien::Shire::Data|Date::Tolkien::Shire::Data>. It is intended
to be reasonably compatible with the same-named L<DateTime|DateTime>
method, but has some additions to deal with the peculiarities of the
Shire calendar.
See L<__format()|Date::Tolkien::Shire::Data/__format> in
L<Date::Tolkien::Shire::Data|Date::Tolkien::Shire::Data> for the
documentation, since that is the code that does the heavy lifting for
us.
lib/Date/Tolkien/Shire.pm view on Meta::CPAN
and calculated back 6000 years from 1958 and set this as the start of the
4th age (1422).  Thus the fourth age begins in our B.C 4042.
According to Appendix D of the Lord of the Rings, leap years in the
hobbits'
calendar are every 4 years unless it is the turn of the century, in which
case it is not a leap year.  Our calendar uses every 4 years unless it
is
100 years unless it is 400 years.  So, if no changes had been made to
the hobbits' calendar since the end of the third age, their calendar would
be about 15 days further behind ours now then when the War of the Ring took
place.  Implementing this seemed to me to go against Tolkien's general habit
of converting dates in the novel to our equivalents to give us a better
sense of time.  My thoughts, at least right now, is that it is truer to the
spirit of things for March 25 today to be about the same as March 25 was back
then.  So instead, I have modified Tolkien's description of the hobbits'
calendar so that leap years occur once every 4 years unless it is 100
years unless it is 400 years, so that it matches our calendar in that
regard.  These 100 and 400 year intervals occur at different times in
the two calendars, however.  Thus the last day of our year is sometimes
7 Afteryule, sometimes 8, and sometimes 9.
=head1 BIBLIOGRAPHY
Tolkien, J. R. R. I<Return of the King>.  New York: Houghton Mifflin Press,
lib/Date/Tolkien/Shire.pm view on Meta::CPAN
Copyright (c) 2001-2003, 2006 Tom Braun. All rights reserved.
Copyright (C) 2017-2022, 2025 Thomas R. Wyant, III
The calendar implemented on this module was created by J.R.R. Tolkien,
and the copyright is still held by his estate.  The license and
copyright given herein applies only to this code and not to the
calendar itself.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself. For more details, see the full text
of the licenses in the directory LICENSES.
view release on metacpan or search on metacpan
lib/Date/Utility.pm view on Meta::CPAN
Takes the following argument as named parameter:
=over 4
=item * C<year> - calendar year of the date (Integer)
=item * C<month> - calendar month of the date. (Integer)
=item * C<day> - day of the month of the date. (Integer)
=back
view release on metacpan or search on metacpan
lib/Date/Utils.pm view on Meta::CPAN
L<https://github.com/manwar/Date-Utils>
=head1 ACKNOWLEDGEMENTS
Entire logic is based on the L<code|http://www.fourmilab.ch/documents/calendar> written by John Walker.
=head1 SEE ALSO
=over 4
view release on metacpan or search on metacpan
lib/Date/Vruceleto.pm view on Meta::CPAN
=encoding UTF-8
=head1 NAME
Date::Vruceleto - Compute year's vruceleto and solar cycle as used in
old Russian calendar
=head1 SYNOPSIS
  use Date::Vruceleto;
  $letter = vruceleto(2016); # NB: means year 2016 since March 1, 5508 BCE
lib/Date/Vruceleto.pm view on Meta::CPAN
other dating techniques.
The cycle of correspondences between vruceletos and the days of the
week is repeated every 28 years, a period also used in old Russian
chronology as "solar cycle". The count of solar cycles in this
calendar system starts from March 1, 5508 BCE (called Constantinople
World Aera).
I.A.Klimishin in his book "Calendar and Chronology" (Moscow, Nauka,
1985, pp. 66-70) gives the following formulae to calculate solar
cycles and vruceletos ([] meaning the integer part of the quotient and
lib/Date/Vruceleto.pm view on Meta::CPAN
The module is intended to find only "the vruceleto of the year" and
not to be used as a Perpetual Calendar, though it may be helpful in
building some tools that achieve that goal.
The module is intended for use in work with old Russian texts as well
as ecclesiastical calculations, i.e. where Julian calendar is
common. Usage with Gregorian calendar is generally senseless and thus
untested.
=head2 EXPORT
None by default. I<solarcycle>, I<vruceleto> and I<vrutseleto> can be
view release on metacpan or search on metacpan
WeekOfYear.pm view on Meta::CPAN
  my $weekNo = WeekOfYear($the_time, 1);  # Week number for $the_time in pre ISO 8601 mode
=head1 ISO 8601
Weeks in a Gregorian calendar year can be numbered for each year. This style of
numbering is commonly used (for example, by schools and businesses) in some European
and Asian countries, but rare elsewhere.
ISO 8601 includes the ISO week date system, a numbering system for weeks - each week
begins on a Monday and is associated with the year that contains that week's Thursday
view release on metacpan or search on metacpan
# methods that are recommended if applicable:
# year, month, day, is_leap
$BEGINNING=1721426; # 1 Jan 1 in the Gregorian calendar, although technically, 
                    # the Gregorian calendar didn't exist at the time.
$VERSION_TODAY=2450522; # today in JDN, when I wrote this.
sub new { # straight out of the perlobj manpage:
    my $class = shift;
package Date::Convert::Gregorian;
use Carp;
@ISA = qw ( Date::Convert );
$GREG_BEGINNING=1721426; # 1 Jan 1 in the Gregorian calendar, although
                    # technically, the Gregorian calendar didn't exist at
                    # the time.
@MONTHS_SHORT  = qw ( nil Jan Feb Mar Apr May Jun July Aug Sep Oct Nov Dec );
@MONTH_ENDS    = qw ( 0   31  59  90  120 151 181  212 243 273 304 334 365 );
@LEAP_ENDS     = qw ( 0   31  60  91  121 152 182  213 244 274 305 335 366 );
@MONTHS = ('Nissan', 'Iyyar', 'Sivan', 'Tammuz', 'Av',
	'Elul', 'Tishrei', 'Cheshvan', 'Kislev', 'Teves',
	'Shevat', 'Adar', 'Adar II' );
# In the Hebrew calendar, the year starts in the seventh month, there can
# be a leap month, and there are two months with a variable number of days.
# Rather than calculate do the actual math, let's set up lookup tables based
# on year length.  :)
%MONTH_START=
    my $self = shift;
    return $$self{year} if exists $$self{year};
    my $days=$$self{absol};
    my $year=int($days/365)-3*365; # just an initial guess, but a good one.
    warn "Date::Convert::Hebrew isn't reliable before the beginning of\n".
	"\tthe Hebrew calendar" if $days < $HEBREW_BEGINNING;
    $year++ while rosh Date::Convert::Hebrew ($year+1)<=$days;
    $$self{year}=$year;
    $$self{days}=$days-(rosh Date::Convert::Hebrew $year)+1;
    return $year;
}
=head1 SUBCLASS SPECIFIC NOTES
=head2 Absolute
The "Absolute" calendar is just the number of days from a certain reference
point.  Calendar people should recognize it as the "Julian Day Number" with
one minor modification:  When you convert a Gregorian day n to absolute,
you get the JDN of the Gregorian day from noon on.
Since "absolute" has no notion of years it is an extremely easy calendar
for conversion purposes.  I stole the "absolute" calendar format from
Reingold's emacs calendar mode, for debugging purposes.
The subclass is little more than the base class, and as the lowest common
denominator, doesn't have any special functions.
=head2 Gregorian
The Gregorian calendar is a purely solar calendar, with a month that is
only an approximation of a lunar month.  It is based on the old Julian
(Roman) calendar.  This is the calendar that has been used by most of the
Western world for the last few centuries.  The time of its adoption varies
from country to country.  This B<::Gregorian> allows you to extrapolate
back to 1 A.D., as per the prorgamming tradition, even though the calendar
definitely was not in use then.
In addition to the required methods, B<Gregorian> also has B<year>,
B<month>, B<day>, and B<is_leap> methods.  As mentioned above, B<is_leap>
can also be used statically.
=head2 Hebrew
This is the traditional Jewish calendar.  It's based on the solar year, on
the lunar month, and on a number of additional rules created by Rabbis to
make life tough on people who calculate calendars.  :)  If you actually wade
through the source, you should note that the seventh month really does come
before the first month, that's not a bug.
It comes with the following additional methods: B<year>, B<month>, B<day>,
B<is_leap>, B<rosh>, B<part_add>, and B<part_mult>.  B<rosh> returns the
absolute day corresponding to "Rosh HaShana" (New year) for a given year,
and can also be invoked as a static.  B<part_add> and B<part_mult> are
useful functions for Hebrew calendrical calculations are not for much else;
if you're not familiar with the Hebrew calendar, don't worry about them.
=head2 Islamic
The traditional Muslim calendar, a purely lunar calendar with a year that
is a rough approximation of a solar year.  Currently unimplemented.
=head2 Julian
The old Roman calendar, allegedly named for Julius Caesar.  Purely solar,
with a month that is a rough approximation of the lunar month.  Used
extensively in the Western world up to a few centuries ago, then the West
gradually switched over to the more accurate Gregorian.  Now used only by
the Eastern Orthodox Church, AFAIK.
B<convert> function, since the base class handles them nicely.
First, a quick conceptual overhaul: the base class uses an "absolute day
format" (basically "Julian day format") borrowed from B<emacs>.  This is
just days numbered absolutely from an extremely long time ago.  It's really
easy to use, particularly if you have emacs and emacs' B<calendar mode>.
Each Date::Convert object is a reference to a hash (as in all OO perl) and
includes a special "absol" value stored under a reserved "absol" key.  When
B<initialize> initializes an object, say a Gregorian date, it stores
whatever data it was given in the object and it also calculates the "absol"
equivalent of the date and stores it, too.  If the user converts to another
=head1 ACKNOWLEDGEMENTS AND FURTHER READING
The basic idea of using astronomical dates as an intermediary between all
calculations comes from Dershowitz and Reingold.  Reingold's code is the
basis of emacs's calendar mode.  Two papers describing their work (which I
used to own, but lost!  Darn.) are:
``Calendrical Calculations'' by Nachum Dershowitz and Edward M. Reingold,
I<Software--Practice and Experience>, Volume 20, Number 9 (September,
1990), pages 899-928.  ``Calendrical Calculations, Part II: Three
view release on metacpan or search on metacpan
lib/DateTime/Astro.pm view on Meta::CPAN
DateTime::Astro - Functions For Astromical Calendars
=head1 DESCRIPTION
DateTime::Astro implements functions used in astronomical calendars, such
as calculation of lunar longitudea and solar longitude.
This module is best used in environments where a C compiler and the MPFR arbitrary precision math library is installed. It can fallback to using Math::BigInt, but that would pretty much render it useless because of its speed and loss of accuracy that...
=head1 DISCLAIMER
view release on metacpan or search on metacpan
lib/DateTime/Calendar/Chinese.pm view on Meta::CPAN
  my ($rd_days, $rd_secs, $rd_nanosecs) = $dt->utc_rd_values();
=head1 DESCRIPTION
This is an implementation of the Chinese calendar as described in 
"Calendrical Calculations" [1]. Please note that the following description
is the description from [1], and the author has not made attempts to verify
the correctness of statements with other sources.
The Chinese calendar described in [1] is expressed in terms of "cycle",
"cycle_year", "month", "a boolean leap_month", and "day".
Traditional Chinese years have been counted using the "Sexagecimal Cycle
of Names", which is a cycle of 60 names for each year. The names are
the combination of a "celestial stem" (tian1 gan1), with a "terrestrial branch"
view release on metacpan or search on metacpan
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
	    }
	    if ( $rd =~ m/ \A [0-9] /smx
		    and my @rda = split qr{ [^0-9]+ }smx, $rd ) {
		return $class->_process_reform_date( \@rda );
	    }
	    Carp::croak( "Unknown calendar region '$rd'" );
	} elsif ( ref $class && ( ref $class )->can( 'reform_date' ) ) {
	    return $class->reform_date();
	} else {
	    return $class->DefaultReformDate();
	}
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
    if (defined $args{year}) {
        $self->{date} = DateTime::Calendar::Julian->new(%args);
        if ($self->{date} >= $self->{reform_date}) {
            $self->{date} = DateTime->new(%args);
            $self->_adjust_calendar;
        }
    }
    return $self;
}
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
	    delete $arg->{reform_date} ),
    }, ref $class || $class;
    if ( $method ) {
	$self->{date} = DateTime->$method( %{ $arg } );
	$self->_adjust_calendar();
    }
    return $self;
}
sub _adjust_calendar {
    my $self = shift;
    if ($self->is_gregorian and $self->{date} < $self->{reform_date}) {
        $self->{date} = DateTime::Calendar::Julian->from_object(
                                                object => $self->{date} );
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
sub is_gregorian {
    return ! $_[0]->is_julian;
}
sub calendar_name {
    my ( $self ) = @_;
    return $self->is_julian() ? 'Julian' : 'Gregorian';
}
sub from_epoch {
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
    }
    my $self = $class->new( %p );
    if ($self->month != $p{month}) {
        # Apparently, month N+1 does not have a day 1.
        # This means that this date is removed in the calendar reform,
        # and the last day of month N is the last day before the reform.
        $self = $self->from_object( object => $self->{reform_date} );
    }
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
    # about 300, and reform_date lies at the beginning of the next year.
    if ($year != $self->{reform_date}->year) {
        return $self->{date}->is_leap_year;
    }
    # Difficult case: $year is in the year of the calendar reform
    # Test if Feb 29 exists
    my $d = eval { $self->new( year  => $year,
                               month => 2,
                               day   => 29,
                             ) };
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
sub add_duration {
    my ($self, $dur) = @_;
    # According to the papal bull and the English royal decree that
    # introduced the Gregorian calendar, dates should be calculated as
    # if the change did not happen; this makes date math very easy in
    # most cases...
    # But not all.
    my %deltas = $dur->deltas;
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
    if ( my $days = delete $deltas{days} ) {
	# Days must not be adjusted further, for sanity's sake. See RT
	# 140734.
	$self->{date}->add( days => $days );
	$self->_adjust_calendar;
    }
    if ( my $months = delete $deltas{months} ) {
	# This must be adjusted to avoid regression.
	# TODO there are other sane things to do here.
	my $start_jul = $self->is_julian;
	$self->{date}->add( months => $months);
	$self->_adjust_calendar;
	# The intent of the following code is to implement the usual
	# conversion, by adding or subtracting the Gregorian deviation
	# as of the reform date. An example would be that George
	# Washington was born on February 11 1732 Julian. The reform
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
	# then in Gregorian for the rest of the interval, and vice versa
	# for subtraction. But that would involve going back and redoing
	# tha calculation.
	#
	# What this implementation does is to recognize that part of the
	# calculation has been done in the wrong calendar, and correct
	# for the number of leap year days that did (or did not) occur
	# under the correct calendar.
	#
	# The original implementation nade this correction in all cases.
	# But as Christian Carey found out, this gives incorrect (or at
	# least very surprising) results when adding or subtracting
	# enough days to not only cross the reform date but cross one of
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
    }
    if ( keys %deltas ) {
	$self->{date}->add( %deltas );
	$self->_adjust_calendar;
    }
    return $self;
}
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
}
sub set_time_zone {
    my ( $self, @arg ) = @_;
    $self->{date}->set_time_zone( @arg );
    $self->_adjust_calendar;
    return $self;
}
# This code assumes there is a month of December of the previous year.
sub day_of_year {
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
}
sub strftime {
    my ( $self, @fmts ) = @_;
    foreach ( @fmts ) {
	s/ %\{ ( calendar_name ) \} / $self->_strftime_helper( "$1" ) /smxge;
    }
    return $self->{date}->strftime( @fmts );
}
sub _strftime_helper {
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
1;
__END__
=head1 NAME
DateTime::Calendar::Christian - Dates in the Christian calendar
=head1 SYNOPSIS
  use DateTime::Calendar::Christian;
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
                                            reform_date => $datetime );
=head1 DESCRIPTION
DateTime::Calendar::Christian is the implementation of the combined
Julian and Gregorian calendar.
See L<DateTime> for information about most of the methods.
=head1 BACKGROUND
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 accumulated 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.
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
specify this.
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 )
                                                   );
or equivalently:
  $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.
=item * from_epoch, from_object, from_day_of_year, last_day_of_month
These methods accept an additional "reform_date" argument. Note that the
epoch is defined for most (all?) systems as a date in the Gregorian
calendar. B<But> this module will still represent it as a Julian date if
the epoch gives a date before the reform date.
=item * reform_date
Returns the date of the calendar reform, as a DateTime object.
=item * is_julian, is_gregorian
Return true or false indicating whether the datetime object is in a
specific calendar.
=item * calendar_name
Return C<'Julian'> or C<'Gregorian'>, depending on the value returned by
C<is_julian()>.
=item * is_leap_year
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.
=item * days_in_year
Returns the number of days in the year. Is equal to 365 or 366, except
for the year(s) of the calendar reform.
=item * day_of_year, day_of_year_0
Returns the day of the year, either one-based or zero-based depending on
the actual method called. In the reform year this is the actual number
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
When months and/or years are involved, the result is modified from a
straight I<rata die> calculation to add or subtract the number of days
skipped by the reform. Without this modification, George Washington's
birthday of February 11 Julian would drift forward in the Gregorian
calendar as the difference between the two calendars increased. With
this modification, it is February 22 Gregorian regardless of the actual
days difference between the two calendars.
B<Note> that in versions C<0.12> and earlier this modification was
applied to B<all> durations. This produced anomalous (i.e. wrong)
results when adding or subtracting large numbers of days.
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
=item * strftime
This override allows selected methods of this class (i.e. not inherited
from DateTime) to be used in the C<'%{method_name}'> construction in
templates. The only method allowed at the moment is C<calendar_name>.
=item * gregorian_deviation( [$datetime] )
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.
This deviation increments on March 1 (Julian) of any year which is a
leap year in the Julian calendar but not the Gregorian calendar.
=item * julian_deviation( [$datetime] )
This method was added in version 0.13.
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.
This deviation increments on March 1 (Gregorian) of any year which is a
leap year in the Julian calendar but not the Gregorian calendar.
=item * DefaultReformDate
This static method returns a L<DateTime|DateTime> object representing
the default reform date. If called with an argument, the argument
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
=back
=head1 SPECIFYING REFORM DATE
The reform date represents the first date the Gregorian calendar came
into use. It can be specified a number of different ways:
=over
=item * A DateTime object, or an object that can be converted into one.
lib/DateTime/Calendar/Christian.pm view on Meta::CPAN
=head1 BUGS
=over
=item * There are problems with calendars switch to Gregorian before 200 AD or after about 4000 AD. Before 200 AD, this switch leads to duplication of dates. After about 4000 AD, there could be entire missing months. (The module can handle dates befo...
=item * There may be functions that give the wrong results for the year of the calendar reform. The function C<truncate()> is a known problem, and C<today()> may be a problem. If you find any more problems, please let me know.
=back
=head1 SUPPORT
view release on metacpan or search on metacpan
lib/DateTime.pm view on Meta::CPAN
            return $object->clone;
        }
        my ( $rd_days, $rd_secs, $rd_nanosecs ) = $object->utc_rd_values;
        # A kludge because until all calendars are updated to return all
        # three values, $rd_nanosecs could be undef
        $rd_nanosecs ||= 0;
        # This is a big hack to let _seconds_as_components operate naively
        # on the given value. If the object _is_ on a leap second, we'll
lib/DateTime.pm view on Meta::CPAN
=head1 DESCRIPTION
DateTime is a class for the representation of date/time combinations, and is
part of the Perl DateTime project.
It represents the Gregorian calendar, extended backwards in time before its
creation (in 1582). This is sometimes known as the "proleptic Gregorian
calendar". In this calendar, the first day of the calendar (the epoch), is the
first day of year 1, which corresponds to the date which was (incorrectly)
believed to be the birth of Jesus Christ.
The calendar represented does have a year 0, and in that way differs from how
dates are often written using "BCE/CE" or "BC/AD".
For infinite datetimes, please see the L<DateTime::Infinite|DateTime::Infinite>
module.
lib/DateTime.pm view on Meta::CPAN
=head3 DateTime->from_object( object => $object, ... )
This class method can be used to construct a new DateTime object from any
object that implements the C<utc_rd_values> method. All C<DateTime::Calendar>
modules must implement this method in order to provide cross-calendar
compatibility. This method accepts a C<locale> and C<formatter> parameter
If the object passed to this method has a C<time_zone> method, that is used to
set the time zone of the newly created C<DateTime> object.
lib/DateTime.pm view on Meta::CPAN
=head3 $dt->week
   my ( $week_year, $week_number ) = $dt->week;
Returns information about the calendar week for the date. The values returned
by this method are also available separately through the C<< $dt->week_year >>
and C<< $dt->week_number >> methods.
The first week of the year is defined by ISO as the one which contains the
fourth day of January, which is equivalent to saying that it's the first week
to overlap the new year by at least four days.
Typically the week year will be the same as the year that the object is in, but
dates at the very beginning of a calendar year often end up in the last week of
the prior year, and similarly, the final few days of the year may be placed in
the first week of the next year.
=head3 $dt->week_year
lib/DateTime.pm view on Meta::CPAN
ones. Infinite datetime objects are documented in L<DateTime::Infinite>.
=head3 $dt->utc_rd_values
Returns the current UTC Rata Die days, seconds, and nanoseconds as a three
element list. This exists primarily to allow other calendar modules to create
objects based on the values provided by this object.
=head3 $dt->local_rd_values
Returns the current local Rata Die days, seconds, and nanoseconds as a three
lib/DateTime.pm view on Meta::CPAN
is equivalent to this:
    @dates = sort { DateTime->compare( $a, $b ) } @dates;
DateTime objects can be compared to any other calendar class that implements
the C<utc_rd_values> method.
=head2 Testing Code That Uses DateTime
If you are trying to test code that calls uses DateTime, you may want to be to
lib/DateTime.pm view on Meta::CPAN
If you can always use the floating or UTC time zones, you can skip ahead to
L<Leap Seconds and Date Math>
=item * date vs datetime math
If you only care about the date (calendar) portion of a datetime, you should
use either C<< $dt->delta_md >> or C<< $dt->delta_days >>, not C<<
$dt->subtract_datetime >>. This will give predictable, unsurprising results,
free from DST-related complications.
=item * $dt->subtract_datetime and $dt->add_duration
lib/DateTime.pm view on Meta::CPAN
answer because it first subtracts one day to get 2003-04-05T03:01:00 and then
subtracts 3 minutes to get the final result.
If we explicitly reverse the order we can get the original value of C<$dt1>.
This can be facilitated by the L<DateTime::Duration> class's C<<
$dur->calendar_duration >> and C<< $dur->clock_duration >> methods:
    $dt2->subtract_duration( $dur->clock_duration )
        ->subtract_duration( $dur->calendar_duration );
=head3 Leap Seconds and Date Math
The presence of leap seconds can cause even more anomalies in date math. For
example, the following is a legal datetime:
lib/DateTime.pm view on Meta::CPAN
pattern. This inconsistency is necessary for backwards compatibility.
There are many cases where CLDR patterns distinguish between the "format" and
"stand-alone" forms of a pattern. The format pattern is used when the thing in
question is being placed into a larger string. The stand-alone form is used
when displaying that item by itself, for example in a calendar.
There are also many cases where CLDR provides three sizes for each item, wide
(the full name), abbreviated, and narrow. The narrow form is often just a
single character, for example "T" for "Tuesday", and may not be unique.
lib/DateTime.pm view on Meta::CPAN
This is a special case. It always produces a two-digit year, so "1976" becomes
"76". Negative years will start with a "-", making them one character longer.
=item * Y{1,}
The year in "week of the year" calendars, from C<< $dt->week_year >>.
=item * u{1,}
Same as "y" except that "uu" is not a special case.
lib/DateTime.pm view on Meta::CPAN
All format modules start with
L<DateTime::Format::|https://metacpan.org/search?q=datetime%3A%3Aformat>.
=head2 Calendar Modules
There are a number of modules on CPAN that implement non-Gregorian calendars,
such as the Chinese, Mayan, and Julian calendars.
All calendar modules start with
L<DateTime::Calendar::|https://metacpan.org/search?q=datetime%3A%3Acalendar>.
=head2 Event Modules
There are a number of modules that calculate the dates for events, such as
Easter, Sunrise, etc.