Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Determing Tomorrow's Day of the Week

Keywords:   tomorrow day of the week

Question:

I'm trying to capture tomorrows 'Day of the Week' in a variable named runday. The code below worked fine until today. It displayed correctly until it was suppose to display a runday='FRIDAY'. At this point runday = ' '. What am I doing wrong? Thanks in advance.
; MY CODE: (problem will occur if this code ; is run today 9/16/1999)
now=TimeYmdHms()
julianday=TimeJulianDay(now)
day= julianday mod 7
day= day + 2 ; plus 2 makes runday equal to ; tomorrows day of the week.
runday=ItemExtract(day,"Friday Saturday Sunday Monday Tuesday Wednesday Thursday"," ")
pause(runday,runday)

Answer:

The problem was that after you used the MOD function to make sure you have a good day number between zero and 6, then you added 2 to it.

Add 2 to it BEFORE the MOD operation...

You probably want...

; MY CODE: (problem will occur if this code ; is run today 9/16/1999)
now=TimeYmdHms()
julianday=TimeJulianDay(now)
julianday= julianday + 2 ; plus 2 makes runday equal to ; tomorrows day of the week.
day= julianday mod 7
runday=ItemExtract(day,"Friday Saturday Sunday Monday Tuesday Wednesday Thursday"," ")
pause(runday,runday)

Article ID:   W14312
Filename:   Tomorrows Day of the Week.txt