[PBP-pm] Working with dates

Bennett Todd bet at rahul.net
Wed Dec 21 10:54:28 PST 2005


I'm not sure there's a one-size-fits-all best practice here.

For external representations, I really like ISO 8601 / RFC 3339,
like 2005-12-21T18:50:14Z.

For many sorts of interval calculations, I'm quite happy using
time_t (integer seconds since 1970-01-01T00:00:00Z in a POSIX
fantasy world where leap seconds don't exist), converting printable
=> time_t with Date::Parse (from TimeDate), and back with
Date::Format (likewise) if I need Date::Parse, POSIX::strftime if
not.

For quick one-offs, or anything where performance isn't that
critical (i.e. I'm not doing a zillion date calculations)
Date::Manip is comforting to have around.

-Bennett
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/pbp-pm/attachments/20051221/37109057/attachment.bin


More information about the PBP-pm mailing list