Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: How do I find difference between two timestamps?

by ikegami (Patriarch)
on Nov 16, 2004 at 17:20 UTC ( #408175=note: print w/replies, xml ) Need Help??


in reply to How do I find difference between two timestamps?

use Time::Local; $start = '2004-11-15T18:59:52.863Z'; $end = '2004-11-15T19:09:52.972Z'; @parts = $start =~ /^(.{4})-(.{2})-(.{2})T(.{2}):(.{2}):(.{2})\.(.{3}) +Z$/; $start_secs = pop(@parts) / 1000; $start_secs += timegm reverse @parts; @parts = $end =~ /^(.{4})-(.{2})-(.{2})T(.{2}):(.{2}):(.{2})\.(.{3})Z$ +/; $end_secs = pop(@parts) / 1000; $end_secs += timegm reverse @parts; $diff = $end_secs - $start_secs; printf("%.3f$/", $diff); # 600.109

Replies are listed 'Best First'.
Re^2: How do I find difference between two timestamps?
by my_perl (Initiate) on Nov 16, 2004 at 22:17 UTC
    Thanks :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2022-01-22 12:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (62 votes). Check out past polls.

    Notices?