
Time::Timestamp - Perl extension the easy manipulation of timestamps (subclass of datetime)

use Time::Timestamp;
my $t = Time::Timestamp->new(ts => time) or Time::Timestamp->new(ts => $strTime,time_zone => 'local');
print $t->tsIso()."\n";
print $->eepoch()."\n";
$t->set_time_zone('local');
$t->set_time_zone('America/New_York');
$t->set_time_zone('UTC');

This takes the best of DateTime / HTTP::Date and mixes them together. HTTP::Date has some great date parsing capability, so we use that to translate most any time format and store it as a DateTime obj. Everything is calculated and stored as eepoch, so local timezone won't be an issue util you need to translate.

Object Constructor. Uses HTTP::Date to parse date strings.
Accepts:
ts => [int|string], defaults to time() time_zone => [int|string], defaults to 'UTC' (hint, using time_zone => 'local' is a good thing, then use the epoch() for saving ;-))
This returns the ts in ISO format 'yyyy-dd-mm hh:mm:ss'. When passed a timezone string, it will return the translated time for that zone.
$t->tsIso('UTC'); returns tsIso() for UTC.
$t->tsIso('America/New_York'); returns tsIso for that timezone (same with 'local');
$t->tsIso() will return a value for the stored timezone
The timezone of the Time::Timestamp object is changed for a moment to accomplish the translation, but is returned before the value is returned.
Returns the ts in ISO shorthand format 'yyyyddmmhhmmss'. Good for serial revisioning. When passed a timezone string, it will return the translated time for that zone.
$t->tsIsoShort('UTC'); returns tsIso() for UTC.
$t->tsIsoShort('America/New_York'); returns tsIso for that timezone (same with 'local');
$t->tsIsoShort() will return a value for the stored timezone
The timezone of the Time::Timestamp object is changed for a moment to accomplish the translation, but is returned before the value is returned.

Returns the eepoch version of your string (interface to HTTP::Date::str2time)
my $t = Time::Timetamp::normalize($strTime,$TZ);

DateTime,DateTime::Timezone,HTTP::Date

Wes Young, <saxguard9-cpan@yahoo.com>

Copyright (C) 2006 by Wes Young
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.