WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Time - Timer and Date Functions
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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
File Created: 1999:10:26:11:23:14
Last Updated: 1999:10:26:11:23:14