in reply to Difference in times (in minutes)

Not clear on what you mean by "in minutes"...round up or down or use floating point? Or did you actually mean seconds? Anyway, this does floating point, in what I hope is an educational (or even amusing) way:
$end_time = shift || "16:54:28"; $start_time = shift || "16:54:23"; if (($end_time =~ /(\d+)/)[0] < ($start_time =~ /(\d+)/)[0] || ($end_time =~ /(\d+)/)[0] == ($start_time =~ /(\d+)/)[0] && (($end_time =~ /(\d+)/g)[1] < ($start_time =~ /(\d+)/g)[1] || ($end_time =~ /(\d+)/g)[1] == ($start_time =~ /(\d+)/g)[1] && ($end_time =~ /(\d+)/g)[2] < ($start_time =~ /(\d+)/g)[2])) { $end_time =~ s/(\d+)/24+$1/e; } use List::Util "sum"; $mindiff = sum(map( 60**(2-$_)*(($end_time =~ /(\d+)/g)[$_]-($start_ti +me =~ /(\d+)/g)[$_]), 0..2 ))/60; print $mindiff, "minutes (", $mindiff*60, " seconds)\n";
But if these are really local times, you are going to have trouble over dst boundaries (and some numbers will be ambiguous).

Replies are listed 'Best First'.
Re^2: Difference in times (in minutes)
by blackadder (Hermit) on Dec 14, 2004 at 15:58 UTC
    Thanks for all the responses.

    Only on PM one can get such a wonderful support.

    Blackadder