Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: get remaining hours

by Kenosis (Priest)
on May 06, 2013 at 06:17 UTC ( #1032179=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: get remaining hours
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032179]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2015-07-30 04:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls