That's a rather strange approach to take. Time::Seconds defines one month as 2,629,744 seconds (exactly one twelfth of a year). So by adding one month, you're actually adding 30 days, 10 hours, 29 minutes and 4 seconds. Which seems a strange way to approach this problem.
This issue becomes obvious if you print out the time parts of your object too.
#/usr/bin/perl
use strict;
use warnings;
use Time::Piece;
use Time::Seconds;
my $date = Time::Piece->strptime( "2002-01-31", '%Y-%m-%d' );
print "\n Date:",$date->ymd, ' ', $date->hms;
$date += ONE_MONTH;
print "\n Date:",$date->ymd, ' ', $date->hms;
Which displays:
Date:2002-01-31 00:00:00
Date:2002-03-02 10:29:04
--
< http://dave.org.uk>
"The first rule of Perl club is you do not talk about
Perl club." -- Chip Salzenberg
|