In Access, the Weekday function returns an integer between 1 (Sunday) and 7 (Saturday) that represents the day of the week corresponding to the date and the first day of the week provided as arguments.
The syntax for the Weekday function is:
Weekday ( date, [firstdayofweek] )
The argument date is any numeric expression that can represent a date and/or time. Numbers to the left of the decimal point in date represent the date; numbers to the right represent the time. If date is Null, this function returns a Null. The firstweekday argument is an optional integer argument that specifies the first day of the week. The following is a list of valid parameters for firstweekday.
Constant | Value | Description |
vbUseSystem | 0 | Use the NLS API settings |
vbSunday | 1 | Sunday (default used) |
vbMonday | 2 | Monday |
vbTuesday | 3 | Tuesday |
vbWednesday | 4 | Wednesday |
vbThursday | 5 | Thursday |
vbFriday | 6 | Friday |
vbSaturday | 7 | Saturday |
Examples
|
VBA Code
|
This example uses the Weekday function to obtain the day of the week from a specified date. Now the MyWeekday variable would contain the value of 4.
SQL query
You can also use the Weekday function in a query.
|