in reply to Date::Manip and date
I prefer DateTime with DateTime::Format::Strptime:
use DateTime; use DateTime::Format::Strptime; my $p = DateTime::Format::Strptime->new(on_error=>'croak', pattern => '%Y-%m-%d'); my $dt = $p->parse_datetime('1988-12-13'); print $dt, " -> ", $dt->epoch, "\n"; __END__ 1988-12-13T00:00:00 -> 597974400
(Maybe slightly overkill in this situation but when parsing date/time formats with times and especially handling time zones it becomes really useful.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Date::Manip and date
by SBECK (Chaplain) on Jul 09, 2015 at 17:53 UTC | |
by zwon (Abbot) on Jul 09, 2015 at 22:21 UTC | |
by SBECK (Chaplain) on Jul 10, 2015 at 11:45 UTC |