"Here's a command file that returns the day of the week for a given date. Nothing fancy -- no syntax or reasonableness checks."
parm d="01/01/2000" setvar cal_day "!d" setvar mo str(cal_day,1,2) setvar day str(cal_day,4,2) setvar year str(cal_day,7,(len(cal_day) - 6)) setvar wkday "SUNMONTUEWEDTHUFRISAT" setvar wdleapy "034025036146" setvar wdleapn "144025036146" setvar century !year/100*100 setvar yr !year-!century setvar wday wdleapn if (((!year mod 4) = 0) and ((!year mod 100) <> 0)) or ((!year mod 400) = 0) setvar wday wdleapy endif setvar dv str(wday,!mo,1) setvar dayval (!yr/4)+!yr+!dv+!day if (!century mod 400) = 0 setvar dayval (!dayval - 1) endif setvar dayval (!dayval mod 7) if !dayval = 0 setvar dayval 7 endif setvar daywk str(wkday,(!dayval*3-2),3) echo The day of the week for !cal_day is !daywk.