Subject: | Removing 12 months doesn't always work |
In January, removing 12 months (or exact multiple of 12) from a date
will result in a date with an extra 12 months removed.
***
use Time::Piece;
my $date = Time::Piece->strptime("01 01 2010","%d %m %Y");
print $date->add_months(-12), "\n";
Tue Jan 1 00:00:00 2008
***
The correct date should be Tue Jan 1 00:00:00 2009