Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Please help me with counting days

Please help me with counting days

Please help me with counting days

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.


RE: Please help me with counting days

***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)
    Check if divisible by 400
       it's a leap year
       its not
    check if divisible by 4
       it's a leap year
       its not

That's a little more than the formula but it's not the code.  
Good Luck,

RE: Please help me with counting days

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

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

RE: Please help me with counting days

FUNCTION isLeap%(year%)
IF (year% MOD 100) = 0 THEN
 isLeap% = ((year% MOD 400) = 0)
 isLeap% = ((year% MOD 4) = 0)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close