Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Showing the time difference in a natural format? (Time::Duration)

by ikegami (Pope)
on Sep 21, 2008 at 21:39 UTC ( #712891=note: print w/ replies, xml ) Need Help??


in reply to Showing the time difference in a natural format?

I found Time::Duration

ago( $now - $then, 1 )

Caveats:

  • It simplifies by using year = 365 days and day = 24 hours.
  • It rounds instead of truncating.


Comment on Re: Showing the time difference in a natural format? (Time::Duration)
Download Code
Re^2: Showing the time difference in a natural format? (Time::Duration)
by skx (Parson) on Sep 21, 2008 at 21:48 UTC

    That looks ideal for me, even with the simplifications. ++

    Looking at the name I'm amazed I didn't find that myself.

    Steve
    --
      I searched for "time ago". Unfortunately, many time zones have "ago" in their name (such as "Chicago"). And it either ignored "ago" or it came up lots of irrelevant Time:: modules after those that had "time" and "ago" in their name.

      Update: Since I couldn't stop after the first sentence, the post lost all value. Ignore it :)

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2014-07-30 09:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (230 votes), past polls