logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

DateTime::Calendar::Julian - Dates in the Julian calendar

Author

       Eugene van der Pijll <pijll@gmx.net>

       Thomas R. Wyant, III wyantatcpandotorg

Background

       The  Julian  calendar  was  introduced  by Julius Caesar in 46BC.  It featured a twelve-month year of 365
       days, with a leap year in February every fourth year.  This calendar was adopted by the Christian  church
       in  325AD.   Around  532AD,  Dionysius  Exiguus  moved  the  starting point of the Julian calendar to the
       calculated moment of birth of Jesus Christ. Apart from differing opinions about the  start  of  the  year
       (often  January  1st,  but  also  Christmas,  Easter, March 25th and other dates), this calendar remained
       unchanged until the calendar reform of pope Gregory XIII in 1582.  Some backward countries, however, used
       the Julian calendar until the 18th century or later.

       This module uses the proleptic Julian calendar for years before 532AD, or even  46BC.   This  means  that
       dates  are  calculated  as  if  this  calendar  had  existed  unchanged  from the beginning of time.  The
       assumption is made that January 1st is the first day of the year.

       Note that BC years are given as negative numbers, with 0 denoting the year 1BC (there was no year  0AD!),
       -1 the year 2BC, etc.

Description

       DateTime::Calendar::Julian implements the Julian Calendar.  This module implements all methods of
       DateTime; see the DateTime(3) manpage for all methods.

Methods

       This module implements one additional method besides the ones from DateTime, and changes the output of
       one other method.

       •   calendar_name

           Returns 'Julian'.

       •   gregorian_deviation

           Returns the difference in days between the Gregorian and the Julian calendar.

       •   datetime

             print $dt->datetime( $sep ), "\n";

           This method is equivalent to

             join $sep, $dt->ymd( '-' ), $dt->hms( ':' );

           The $sep argument defaults to 'J'.

           Caveat:  the  optional argument was added to this method in version 1.02, to belatedly track a change
           made in DateTime version 1.43 released 2017-05-29. Fixing this restores the original  stringification
           behavior  of  this  class,  which was to return an ISO-8601 string unless a formatter was set. Before
           this change, the stringification separated date and time with either a 'T' or  a  'J',  depending  on
           which version of DateTime was installed.

       Note that as of version "0.106_01", methods related to quarters should work.

Name

       DateTime::Calendar::Julian - Dates in the Julian calendar

See Also

       DateTime

       DateTime::Calendar::Christian

       datetime@perl.org mailing list

       <http://datetime.perl.org/>

perl v5.32.1                                       2022-01-31                    DateTime::Calendar::Julian(3pm)

Support

       Support  for  this module is provided via the datetime@perl.org email list. See <https://lists.perl.org/>
       for more details.

       Please  report  bugs   to   <https://rt.cpan.org/Public/Dist/Display.html?Name=DateTime-Calendar-Julian>,
       <https://github.com/trwyant/perl-DateTime-Calendar-Julian/issues>,    or    in    electronic    mail   to
       wyant@cpan.org.

Synopsis

         use DateTime::Calendar::Julian;

         $dt = DateTime::Calendar::Julian->new( year  => 964,
                                                month => 10,
                                                day   => 16,
                                              );

         # convert Julian->Gregorian...

         $dtgreg = DateTime->from_object( object => $dt );
         print $dtgreg->datetime;  # prints '0964-10-21T00:00:00'

         # ... and back again

         $dtjul = DateTime::Calendar::Julian->from_object( object => $dtgreg );
         print $dtjul->datetime;  # prints '0964-10-16J00:00:00'

See Also