in reply to Find minutes difference between two dates
(untested code)use Time::Local; while (<>) { my @line=split(";"); my @start_time=($line[3]=~/(\d+)-(\d+)-(\d+)\s(\d+):(\d+):(\d+)/); + #parsing the start time my @stop_time=($line[4]=~/(\d+)-(\d+)-(\d+)\s(\d+):(\d+):(\d+)/); # +parsing the stop time my $start_time = timelocal($start_time[5], $start_time[4], $start_ti +me[3], $start_time[2], $start_time[1], $start_time[0]); my $end_time = timelocal($end_time[5], $end_time[4], $end_time[3], $ +end_time[2], $end_time[1], $end_time[0]); my $min_diff = sprintf("%.0f", ($end_time - $start_time) / 60); print $min_diff."\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Find minutes difference between two dates
by ikegami (Patriarch) on Oct 06, 2009 at 20:25 UTC |