in reply to Re^3: problems parsing Time/Date strings
in thread problems parsing Time/Date strings

Thanks for the links !

I totally agree about the slide comment regarding DateTime::Duration

Luckily DateTime::Format::Human::Duration works around that

#!/usr/bin/perl -- use strict; use warnings; use DateTime::Duration; use DateTime::Format::Human::Duration; use DateTime::Format::Natural; @ARGV = ( "last week", "today" ) unless @ARGV; my $dfn = DateTime::Format::Natural->new; my $start = $dfn->parse_datetime(shift); my $end = $dfn->parse_datetime(shift); my $diff = $end - $start; print "$end - $start = ", DateTime::Format::Human::Duration->new->format_duration($diff), "\n" +; __END__ 2012-08-04T00:00:00 - 2012-07-28T00:00:00 = 1 week