01-12-2012, 02:33 PM
Worked out a function to get the number of days in month of a given year. This takes into account the rules of leap year.
Function GetDaysInMonth
-jim
Function GetDaysInMonth
function int'Month int'Year
int Days
Year-((Year/4)*4)
sel Month
,case [1,3,5,7,8,10,12]
,Days=31
,case [4,6,9,11]
,Days=30
,case 2
,if (Year-((Year/4)*4))=0
,,if Year-((Year/4)*4)=0
,,,if Year-((Year/4)*4)=0
,,,,Days=29
,,,else
,,,,Days=28
,,else
,,,Days=29
,else
,,Days=28
ret Days
-jim