in reply to time diff in minutes
#!/usr/bin/perl use strict; my $t1 = "1245"; my $t2 = "0150"; Get_Time_Diff( $t1, $t2 ); sub Get_Time_Diff { my @times = @_; for my $i (0 .. $#times) { $times[$i] += 1200 if ( $times[$i] < '1200' ); $times[$i] = substr( $times[$i], 0, 2 ) * 60 + substr( $times[$i], 2, 4 ); } my $diff = $times[1] - $times[0]; print "Time difference is: $diff \n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: time diff in minutes
by Boldra (Curate) on Aug 13, 2009 at 06:19 UTC |