Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: finding the day of the week
This code will return the day of week for you.
If we start with the year 0000, day 1 is a Saturday. If we're trying to figure out what day of the week day 8 of the year 0000 is, then c=8 mod 7 = 1. So c would be equal to a Saturday. If we were on day 9 of the year 0000, then c=8 mod 7 = 2. So c would be equal to a Sunday.
But what if we're on day 7 of the year 0000? c=7 mod 7 = 0. The seventh day of the week is evenly divisible by 7 and it is a Friday.
TimeJulianDay mod 7 returns:
1=Sat, 2=Sun, 3=Mon, 4=Tues, 5=Wed, 6=Thurs, 0=Fri.
In the following list, we start the list with Friday and increment c+1, because a Julian date evenly divisible (7 mod 7) would have a remainder of 0 (0=Fri above), and we want to start our ItemExtract list on the first item of the list (can't start a list with the 0th item), hence c=c+1:
a=TimeYmdHms() b=TimeJulianDay(a) c= b mod 7 c=c+1 day=ItemExtract(c,"Fri Sat Sun Mon Tue Wed Thu"," ") Message(a,day)
Article ID: W13867
Filename: Find the day of week.txt
File Created: 1999:06:15:15:16:00
Last Updated: 1999:06:15:15:16:00