Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Days In Month
#1
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
Code:
Select All      Help
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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)