LoginLogin

Number of days in a month

Root / Submissions / [.]

12Me21Created:
This function returns the day of the week of the 1st day in a month, and the number of days in that month.
DEF MONTHINFO YEAR,MONTH OUT FIRSTDAY,DAYS
 VAR FIRST$="%04D/%02D/01"
 DTREAD FORMAT$(FIRST$,YEAR,MONTH) OUT ,,,FIRSTDAY
 INC MONTH
 IF MONTH>12 THEN
  DEC MONTH,12
  INC YEAR
 ENDIF
 VAR NEXTFIRSTDAY
 DTREAD FORMAT$(FIRST$,YEAR,MONTH) OUT ,,,NEXTFIRSTDAY
 DAYS=(NEXTFIRSTDAY-FIRSTDAY+7) MOD 7 +28
END

No posts yet (will you be the first?)