Date-ICal
view release on metacpan or search on metacpan
2001-07-31 22:17 rbowen
* Makefile.PL (1.7): Added Memoize, Storable to prereq list, so
that I can memoize some functions.
2001-07-31 07:43 rbowen
* lib/Date/ICal.pm (1.24): Create a new D::I object using another
D::I object (or subclass) as the initial value. This allows for
immediate conversion of a date from one calendar format to another,
which was one of my main goals to start with. :-)
2001-07-27 12:24 rbowen
* lib/Date/ICal.pm (1.23), t/03components.t (1.1): Creating objects
from components was not working. Fixed.
2001-07-26 14:36 rbowen
* MANIFEST (1.3), lib/Date/ICal.pm (1.22): Removed unused internal
(Where $duration is either a duration string, like 'P2W3DT7H9M', or a
Date::ICal::Duration (qv) object.
$ical += 'P6DT12H';
$duration = $ical - $ical2;
$ical3 = $ical - $duration;
DESCRIPTION
Date::ICal talks the ICal date format, and is intended to be a base
class for other date/calendar modules that know about ICal time format
also.
AUTHOR
Rich Bowen, and the Reefknot team. Alas, Reefknot is no more. See
<https://github.com/houseabsolute/DateTime.pm/wiki> for more modern and
accurate modules.
Last touched by $Author: michal-josef-spacek $
METHODS
);
If you call new without any arguments, you'll get a Date::ICal object
that is set to the time right now.
my $ical = Date::ICal->new();
If you already have an object in Date::ICal, or some other subclass
thereof, you can create a new Date::ICal (or subclass) object using that
object to start with. This is particularly useful for converting from
one calendar to another:
# Direct conversion from Discordian to ISO dates
my $disco = Date::Discordian->new( disco => '12 Chaos, YOLD 3177' );
my $iso = Date::ISO->new( $disco );
print $iso->iso;
new() handles timezones. It defaults times to UTC (Greenwich Mean Time,
also called Zulu). If you want to set up a time that's in the US
"Pacific" timezone, which is GMT-8, use something like:
lib/Date/ICal.pm view on Meta::CPAN
Date::ICal::Duration (qv) object.
$ical += 'P6DT12H';
$duration = $ical - $ical2;
$ical3 = $ical - $duration;
=head1 DESCRIPTION
Date::ICal talks the ICal date format, and is intended to be a base class for
other date/calendar modules that know about ICal time format also.
=head1 AUTHOR
Rich Bowen, and the Reefknot team. Alas, Reefknot is no more. See
L<https://github.com/houseabsolute/DateTime.pm/wiki> for more modern and accurate modules.
Last touched by $Author: michal-josef-spacek $
=head1 METHODS
lib/Date/ICal.pm view on Meta::CPAN
);
If you call new without any arguments, you'll get a Date::ICal object that is
set to the time right now.
my $ical = Date::ICal->new();
If you already have an object in Date::ICal, or some other subclass
thereof, you can create a new Date::ICal (or subclass) object using
that object to start with. This is particularly useful for converting
from one calendar to another:
# Direct conversion from Discordian to ISO dates
my $disco = Date::Discordian->new( disco => '12 Chaos, YOLD 3177' );
my $iso = Date::ISO->new( $disco );
print $iso->iso;
new() handles timezones. It defaults times to UTC (Greenwich
Mean Time, also called Zulu). If you want to set up a time
that's in the US "Pacific" timezone, which is GMT-8, use something
like:
$|=1 unless $harness;
# test greg2jd and jd2greg for various dates
# 2 tests are performed for each date (on greg2jd and jd2greg)
# dates are specified as [jd,year,month,day]
for (
# min and max supported days (for 32-bit system)
[-2**31,-5879610,6,22],[2**31-1,5879611,7,11],
# some miscellaneous dates I had day numbers for (these are
# actually epoch dates for various calendars from Calendrical
# Calculations (1st ed) Table 1.1)
[-1721425,-4713,11,24],[-1373427,-3760,9,7],[-1137142,-3113,8,11],
[-1132959,-3101,1,23],[-963099,-2636,2,15],[-1,0,12,30],[1,1,1,1],
[2796,8,8,27],[103605,284,8,29],[226896,622,3,22],[227015,622,7,19],
[654415,1792,9,22],[673222,1844,3,21]
) {
is(join('/',Date::ICal::jd2greg($_->[0])), join('/',@{$_}[1..3]),
$_->[0]." \t=> ".join'/',@{$_}[1..3]);
is(Date::ICal::greg2jd(@{$_}[1..3]), $_->[0],
( run in 2.872 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )