[Templates] [recipe] Calculating age

Paul Makepeace tt2.org@paulm.com
Wed, 8 Jan 2003 21:34:07 +0000


I just came up with this inexpensive way to show age in years. All the
pieces are straightforward but I thought it was kind of cute.

[% USE date %]
[%# perl -MDate::Parse -le 'print str2time("Apr 10 04:30 +0200 UTC 1974")' %]

Hi, I'm [% ((date.now - 134793000) / 365.2425) div 86400 %].

[%# http://star-www.st-and.ac.uk/~fv/webnotes/chapt17.htm
    for the 365.2425 days in a Gregorian year (error = 1 day in 3320years) %]

Paul

-- 
Paul Makepeace ....................................... http://paulm.com/

"What is a steedle? The delicious aftertaste of purple."
   -- http://paulm.com/toys/surrealism/