#!/usr/bin/perl -- use strict; use warnings; use DateTime::Duration; use DateTime::Format::Human::Duration; use DateTime::Format::Natural; Main( @ARGV ); exit( 0 ); sub Main { @_ == 2 or return print Usage(); 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"; } sub Usage { <<"__USAGE__"; Usage: $0 startdate enddate $0 yesterday now $0 "last week" today $0 "2009-11-17" "2011-11-17" __USAGE__ } ## end sub Usage
In reply to Re: Need help get longest timediff
by Anonymous Monk
in thread Need help get longest timediff
by britney
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |