in reply to Date::Calc in years?
Hello Anonymous Monk,
Fellow Monks have provided a solution to your problem, but just to add an alternative:
You can use the module Date::Manip, which handles really good the dates.
#!/usr/bin/perl use strict; use warnings; use Date::Manip; use feature 'say'; my $date1 = ParseDate("1999-12-13"); my $date2 = ParseDate("2080-05-21"); say Delta_Format(DateCalc($date1, $date2, "approx"), 1, "Years:\t%yv\nMonths:\t%Mv\nWeeks:\t%wv\nDays:\t%dv"); __END__ $ perl test.pl Years: 80 Months: 5 Weeks: 1 Days: 1
Update: New print out format.
Hope this helps, Best Regards.
|
|---|