Keep It Simple, Stupid | |
PerlMonks |
Re: getting answer 70 years offby no_slogan (Deacon) |
on Jan 17, 2014 at 22:12 UTC ( [id://1071027]=note: print w/replies, xml ) | Need Help?? |
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.
In Section
Seekers of Perl Wisdom
|
|