in reply to get remaining hours
Perhaps the following will be helpful:
use strict; use warnings; use Date::Parse; my $start = '2013/01/08 09:26:07'; my $end = '2013/04/11 20:19:12'; print sprintf "%.2f", ( str2time($end) - str2time($start) ) / 3600;
Output:
2241.88
str2time parses a date/time string, returning a unix time value in seconds. It's used above to calculate the difference (delta) between your start and end dates/times. The output is the difference in hours.
|
---|
In Section
Seekers of Perl Wisdom