Posted by Grant Foraker on July 02, 2014 at 13:44:30:
In Reply to: Re: DAYOFWEEK function posted by Yves Ste-Marie on July 02, 2014 at 11:27:53:
Here some OLD code that still works. With the (ZDYCT + 3) in the code it has to break someday.
================================================
LENGTH 1 & LOCAL DT$
LENGTH 2 & LOCAL DOM$, MONTH$
LENGTH 4 & LOCAL YEAR$
LENGTH 7 & LOCAL Z2$
LENGTH 8 & LOCAL MMDDYY$, YYMMDD$
LENGTH 8 & LOCAL AGE$
LENGTH 10 & LOCAL Z1$
LENGTH 1.0 & LOCAL LEAPYR, ZDYWK
LENGTH 2.0 & LOCAL DAY, MONTH, ERR, UX, UY
LENGTH 4.0 & LOCAL YEAR
LENGTH 5.0 & LOCAL TEMPNUM, ZDYYR
LENGTH 6.0 & LOCAL ZDYCT
!------------------------------------------------------------------------
LET MMDDYY$ = MONTH$ + DOM$ + YEAR$
LET ZDYCT = DATETONUM(MMDDYY$,ERR) ! EDIT DATE
IF ERR EQ 1 GOTO INVALIDDATE ! INVALID
LET ZDYWK = (ZDYCT + 3) MOD 7 ! DAY OF WEEK
IF ZDYWK EQ 0 LET ZDYWK = 7 ! SUNDAY
!========================================================================
Monday = 1, ... , Sunday = 7
You might consider upgrading DATETONUM to DATE2NUM.
Each file can be a maximum of 1MB in length Uploaded files will be purged from the server on a regular basis.