I need help to count the days in certain month and certain year (whether it's a leap year or not). Actually I just need the formula to find out if the year is a leap year or not.
Hi,
***divisible means evenly divisible(no remainder)
The century years (1800, 1900,2000) must be divisible by four hundred.
All the other years must be divisible by four.
Check if divisible by 100(a century)
yes
Check if divisible by 400
yes
it's a leap year
no
its not
no
check if divisible by 4
yes
it's a leap year
no
its not
That's a little more than the formula but it's not the code.
Good Luck,
Pappy
Or you may use an Error handling routine to find how many days in that year's February...
force system time to set to 29th of february like
Code:
DATE$ = "02/29/2001"
if systems gives te error "ILLEGAL FUNCTION CALL" you understand that this year is not a Leap Year...
Even you may design a FUNCTION that controls if given year is leap or not (but if you design a Function don't forget to use LOCAL in error handling like "ON LOCAL ERROR GOTO xxx"
If you're interested i may write you a simple code..
Good luck
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.