Weekday Function
Returns an integer representing the day of a week.
Weekday(date, [firstdayofweek])
Parameters
Date
It can represent any expression of a date. IfDateIf the parameter contains Null, returnNull.
Firstdayofweek
Specify the constant of the first day of the week. If omittedVbSunday.
Set
The firstdayofweek parameter has the following settings:
Constant |
Value |
Description |
VbUseSystem |
0 |
Use the regional language support (NLS) API settings. |
VbSunday |
1 |
Sunday |
VbMonday |
2 |
Monday |
VbTuesday |
3 |
Tuesday |
VbWednesday |
4 |
Wednesday |
VbThursday |
5 |
Thursday |
VbFriday |
6 |
Friday |
VbSaturday |
7 |
Saturday |
Return Value
WeekdayThe function returns the following values:
Constant |
Value |
Description |
VbSunday |
1 |
Sunday |
VbMonday |
2 |
Monday |
VbTuesday |
3 |
Tuesday |
VbWednesday |
4 |
Wednesday |
VbThursday |
5 |
Thursday |
VbFriday |
6 |
Friday |
VbSaturday |
7 |
Saturday |
Description
The following example usesWeekdayThe function returns the specified day of the week:
Dim MyDate, MyWeekDayMyDate = #October 19, 1962# '
Dispatch date.MyWeekDay = Weekday(MyDate) '
Because MyWeekDay
Include 6,MyDate
Represents Friday.