in reply to Re: Leap Year
in thread How do I determine if a given year is a leap year?
And the source code for Date::Leapyear reads:
sub isleap { my ($year) = @_; return 1 if (( $year % 400 ) == 0 ); # 400's are leap return 0 if (( $year % 100 ) == 0 ); # Other centuries are not return 1 if (( $year % 4 ) == 0 ); # All other 4's are leap return 0; # Everything else is not }
which is already a provided answer. The same semi-correct formula is also used in Astro::Time and DateTime. Unless someone goes to the touble of encoding the entire FAQ, stick with the original answer. I like CPAN as much as the next Monk, but some modules are wasteful.
Updated: I do note that the DateTime::Calendar::* modules at least make some attempt at dealing with cultural and temporal variances ...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Answer: Leap Year
by Tommy (Chaplain) on Jan 24, 2005 at 15:32 UTC |