NAME

Date::ICal - Perl extension for ICalendar date objects.

SYNOPSIS

use Date::ICal;

$ical = Date::ICal->new( ical => '19971024T120000' );
$ical = Date::ICal->new( epoch => time );
$ical = Date::ICal->new( year => 1964,
    month => 10, day => 16, hour => 16,
    min => 12, sec => 47, tz => '0530' );

$hour = $ical->hour;
$year = $ical->year;

$ical_string = $ical->ical;
$epoch_time = $ical->epoch;

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.

See http://dates.rcbowen.com/unified.txt for details

METHODS

Date::ICal has the following methods available:

new

A new Date::ICal object can be created with any valid ICal string:

my $ical = Date::ICal->new( ical => '19971024T120000' );

Or with any epoch time:

my $ical = Date::ICal->new( epoch => time );

Or, better still, create it with components

my $date = Date::ICal->new( 
                       day => 25, 
                       month => 10, 
                       year => 1066,
                       hour => 7,
                       min => 15,
                       sec => 47
                       );

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;