[Omaha.pm] quickie: GMT time via Date::Calc

Jay Hannah jhannah at omnihotels.com
Wed Nov 30 09:52:21 PST 2005


$ cat j.pl
use Date::Calc qw( Today_and_Now );

printf("Local: %4d-%2d-%2d %2d:%2d:%2d\n", Today_and_Now);
printf("GMT:   %4d-%2d-%2d %2d:%2d:%2d\n", Today_and_Now(1));

$ perl j.pl
Local: 2005-11-30 11:49:26
GMT:   2005-11-30 17:49:26

I tried to figure out how to do that w/ Class::Date and couldn't in 60
seconds so fell back to Date::Calc. Date::Calc is great, it's just not
as slick as Class::Date objects for comparing/manipulating datetimes.

j



More information about the Omaha-pm mailing list