General information
Category:
Coding, syntax & commands
>Hello All,
>A simple question but one I have gone completelty blank on.
>
>How do I define a leap year?? I know that year % 4 returning a 0 is not enough. What's the rest??
The rules are a bit more complicated than that... but unless you deal with dates earlier than 1901 or later than 2099, you shouldn´t worry. In a fox-like pseudocode:
DO CASE
CASE if it´s divisible by 400
it´s a leap year (thus, 2000 is a leap year)
CASE it´s divisible by 100
it´s not a leap year (1900 and 2100 aren´t leap years)
CASE it´s divisible by 4
it´s a leap year (1996 and 2004 are leap years).
OTHERWISE
it´s not a leap year (1997, 1998 and 1999 aren´t leap years).
ENDCASE
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only