|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|
Announce: Handy time "normalization" module
|
Hello all,
I just posted a new module, Time::Normalize, to CPAN. It's no great shakes,
nothing revolutionary or flashy, but people may find it useful. It provides
functions that accept date and time data in a variety of formats, and returns
them in standard, fixed ways, doing error checking and stuff so you don't have
to.
Examples from the README:
($y, $m, $d) = normalize_ymd (2005, 'jan', 7);
# Returns '2005', '01', '07'.
($y, $m, $d, $w, $wn, $wn3, $mn, $mn3) = normalize_ymd ('05', 1, 7);
# Returns '2005', '01', '07', 3, 'Friday', 'Fri', 'January', 'Jan'.
($h24, $m, $s, $h12, $am) = normalize_hms (13, 45);
# Returns '13', '45', '00', 1, 'p'
($h24, $m, $s, $h12, $am) = normalize_hms (11, 45, undef, 'P.M.');
# Returns '23', '45', '00', 11, 'p'
($y, $m, $d) = normalize_ymd (2005, 'February', 29);
# Throws an error: Invalid day "29"
--
Eric
___________________________________________________________________
Privacy Notice: This message has been sent via www.zoemail.net using
patented e-mail protection technology developed by AT&T Labs. Reply to
the "keyed address" above to ensure delivery.
-
**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**
|
|