Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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

Replies are listed 'Best First'.
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?
[LanX]: auto-subtitles in YT are entertaining: "fuehrer" instead of fewer, "jews" instead of juice ...
Discipulus never noticed there was subtitles... can I call them with &subtitle or is too much perl 4?
[LanX]: YT=youtube
[Discipulus]: ;=) yes i'm not SO dumb
[LanX]: SO=StackOverflow

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2017-06-23 16:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (552 votes). Check out past polls.