# Birthday — Calculates birthdays

This procedure finds out on which day of the week people were born.

        PROC Birthday:
              LOCAL day&,month&,year&,DayInWk%
              DO
                    dINIT
                    dTEXT "","Enter your date of birth",2
                    dTEXT "","Use numbers, eg 23 12 1963",$202
                    dLONG day&,"Day",1,31
                    dLONG month&,"Month",1,12
                    dLONG year&,"Year",1900,2155
                    IF DIALOG=0
                          BREAK
                    ENDIF
                    DayInWk%=DOW(day&,month&,year&)
                    CLS :PRINT DAYNAME$(DayInWk%),day&,month&,year&
                    dINIT "Again?"
                    dBUTTONS "No",%N,"Yes",%Y
              UNTIL DIALOG<>%y
        ENDP

The `DOW` function works out what day of the week, from 1 to 7, a date is. The `DAYNAME$` function then converts this to MON, TUE and so on. MON is 1 and SUN is 7.