Calculate date of birth from age at specific date [MySQL or Perl] -
apologies if simple question interested in trying reach accurate answer , not "rounded" answer.
my problem is: know 27.12 on 18th of march 2008 (random example). how can calculate, nearest approximation, date of birth. age provided real number 2 decimal points.
eumiro's answer trick; following, using time::piece module (bundled perl since 5.10) perhaps more maintainable.
use strict; use warnings; use 5.010; use time::piece; use time::seconds; ($date, $age) = ('2008-03-18', 27.12); $birthday = time::piece->strptime($date, '%y-%m-%d') - $age*one_year; $birthday->ymd();
this within few days of actual birthday, due lack of accuracy (1/100 year) in age.
Comments
Post a Comment