Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: How do I find difference between two timestamps?

by ikegami (Patriarch)
on Nov 16, 2004 at 17:20 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-03-28 14:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found