Get the weekday

I needed to find the weekday from a date and at last i've found

In VBSCRIPT the function is WeekDay() which takes an argument of type Date
and returns a number between 1 to 7

1---Sunday (I wonder if an arabian invented VBScript then it would be Friday)
2---MonDay
....
7---Saturday



For example if you want to get the weekday of today

weekday(Date())

Check if this is sunday

IF weekDay(Date())=1 THEN do something

Get the name of the weekday

weekdayname(weekday(Date()))

Get the weekday of yesterday

weekday(DateAdd("d", -1, Date()))

Comments