[Omaha.pm] subclassing Class::Date
Jay Hannah
jhannah at omnihotels.com
Wed Dec 3 13:47:27 PST 2008
I love Class::Date. Omni2::Control::DateTime is our subclass of it, and it lets you write some cool code. :)
- "300s" is just spiffy. :)
j
BEFORE
my $now = time();
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($now - 300);
my $datestring=sprintf("%04d-%02d-%02d %02d:%02d",($year + 1900),($mon + 1),$mday,$hour,$min);
AFTER
my $datestring = (Omni2::Control::DateTime->new() - "300s")->format("%Y-%m-%d %H:%M");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/omaha-pm/attachments/20081203/d956fbce/attachment.html>
More information about the Omaha-pm
mailing list