VBScript » Functions » Weekday

Syntax:
Weekday(Date, FirstDayofWeek)
Date
The Date argument is any valid date expression and you may use the Date and Now functions.
FirstDayofWeek
The optional FirstDayofWeek argument must only use the constants or values defined above in the Date And Time Constants.

The Weekday function returns the number of the day of the week.

The output is defined by the value in the Date And Time Constants.

Date and Time Constants

CONSTANT VALUE DESCRIPTION
VBSunday 1 Sunday
VBMonday 2 Monday
VBTuesday 3 Tuesday
VBWednesday 4 Wednesday
VBThursday 5 Thursday
VBFriday 6 Friday
VBSaturday 7 Saturday
VBFirstJan1 1 Week of January 1
VBFirstFourDays 2 First week of the year that has at least four days
VBFirstFullWeek 3 First full week of the year
VBUseSystem 0 Use the date format of the computer's regional settings
VBUseSystemDayOfWeek 0 Use the first full day of the week as defined by the system settings

Examples

Code:
<% =WeekDay(Date) %>
Output:
3
Language(s): VBScript
Code:
<% =WeekDay(Now) %>
Output:
3
Language(s): VBScript
Code:
<% =WeekDay("6/26/1943") %>
Output:
7
Language(s): VBScript
Code:
<% =WeekDay("6/26/1943", VBMonday) %>
Output:
6
Explanation:

In this example, Monday is defined to be the first day of the week. Therefore, Saturday becomes 6.

Language(s): VBScript

See Also: