Number of days in each month including February calculation of leap year:

by Solitaire (Login Solitaire1)
S

This is a small section of code from a very long program I wrote several years ago, that calculates the day of the week based on the user's date input. (The complete code is in the Proud subforum.)


SELECT CASE month
   CASE 9, 4, 6, 11
     max = 30
   CASE 2
     IF yr MOD 4 = 0 AND (yr MOD 100 <> 0 OR yr MOD 400 = 0) THEN
       max = 29 ' leap year
     ELSE
       max = 28
     END IF
   CASE ELSE
     max = 31
END SELECT

Posted on Nov 13, 2009, 5:38 PM

Respond to this message   

Return to Index


Response TitleAuthor and Date
First day of year weekday number with leap year SUB. on Nov 13
 * Crap, take the COLOR statement out! on Nov 13