Added getMonthsInInterval method analogous to getDaysInInterval method

This commit is contained in:
Frank Dillon 2006-05-01 16:42:06 +00:00
parent 1d6158d4f3
commit 09bece8f8e

View file

@ -463,6 +463,29 @@ sub getMonthName {
}
}
#-------------------------------------------------------------------
=head2 getMonthsInInterval ( start, end )
Returns the number of months between two epoch dates.
=head3 start
An epoch date.
=head3 end
An epoch date.
=cut
sub getMonthsInInterval {
my $self = shift;
my $start = DateTime->from_epoch( epoch =>shift);
my $end = DateTime->from_epoch( epoch =>shift);
my $duration = $end - $start;
return $duration->delta_months;
}
#-------------------------------------------------------------------
=head2 getSecondsFromEpoch ( epoch )