Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: getting answer 70 years off

by no_slogan (Deacon)
on Jan 17, 2014 at 22:12 UTC ( [id://1071027]=note: print w/replies, xml ) Need Help??


in reply to getting answer 70 years off

my $age = (localtime ( time - $time ))[5]

Don't do this. A difference of two times is not something you should pass to localtime. If you only need an approximate age, you can use something like

$age = (time() - $time) / (60*60*24*365.25);

If you want an accurate answer that takes leap years and stuff into account, use a package like Date::Manip or DateTime or whatever.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-20 09:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found