I'd suggest looking at the DateTime effort. DateTime is an effort to create a 'difinitive' date and time parsing and formatting system. It is in very active development (kind of still in developer status, however I'd say its stable enough to start using). You'll need
DateTime,
DateTime::Timezone and
DateTime::Format::iCal.
To use it all to work with your iCal dates, here's a Synopsis:
use DateTime;
use DateTime::Format::ICal;
# Convert 'parts' into an iCal:
my $DateTimeObject1 = DateTime->new(
year=>2003, month=>2, day=>19,
hour=>16, minute=>23, second=>22
);
print DateTime::Format::ICal->format_datetime( $DateTimeObject1);
#20030219T162322Z
# Convert an iCal into parts:
my $DateTimeObject2 = DateTime::Format::ICal->parse_datetime('20030219
+T162322Z');
print $DateTimeObject2->year;
#2003
print $DateTimeObject2->month;
#2
#etc...
Check the DateTime documentation for the piles of other things the DateTime module can do for you. It overrides operators like + and -. If you print the object in scalar format, it will return a string:
print "$DateTimeObject2";
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.