Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1032179]
help
Chatterbox?
[Tanktalus]: Wow, given the time separation of marioroy's oatmeal cookies and Disciplulus' response, I'm amazed that marioroy responded :)
[Discipulus]: no no seriously, redss posed a good question in the right moment, and you gave as always wonderful answers
[Discipulus]: Tanktalus my comment was about how to fork & join in tk?
[marioroy]: Oh, I've might of missed Discipulus's earlier response. I had gone to bed.
[Tanktalus]: ah, I don't even have the perlmonks site open in my browser :)
Tanktalus is chatting through his cbstats application :)
[marioroy]: Perl is so much fun.
[Discipulus]: Tanktalus i recently started a Meditation about marioroy's MCE suit of modules, but is even better to see a practical question answered than responses to my meditation
[Discipulus]: good night mario!

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2017-04-23 19:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (432 votes). Check out past polls.