in reply to Calculate Age, days to next and days from last for a given birthday
Update: added in the Add_Delta_YMD to account for birthdays on 2/29my $birthday = '2000-01-02'; # yyyy-mm-dd use Date::Calc qw/Delta_Days Today Add_Delta_YMD/; my @date = split /-/, $birthday; $date[0] = (Today())[0]; # set the year to current year print Delta_Days( Add_Delta_YMD(@date,-1,0,0), @date ); # days since +last one print Delta_Days( @date, Add_Delta_YMD(@date,1,0,0) ); # days until +next one
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Calculate Age, days to next and days from last for a given birthday
by ruzam (Curate) on Apr 28, 2006 at 20:49 UTC | |
by davidrw (Prior) on Apr 28, 2006 at 22:00 UTC | |
by ruzam (Curate) on Apr 29, 2006 at 05:03 UTC |