Open In App

Weekday() and WeekdayName() Function in MS Access

Last Updated : 23 Sep, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

1. Weekday() Function :
In MS Access, The weekday() function returns the weekday number for a given date. In this function, a date will be passed as a parameter and it returns the weekday of that date. By default the 1 is denoted for Sunday and 7 for Saturday. The second parameter will be optional it will be the first day of the week.

Syntax :

Weekday(date, firstdayofweek)

Parameters Value :

Parameter Description
date It is required. A valid date.
firstdayofweek optional, it will specifies the first day of the week
0 : For NLS API setting
1 : Sunday (default)
2 : Monday
3 : Tuesday
4 : Wednesday
5 : Thursday
6 : Friday
7 : Saturday

Example-1 :

SELECT Weekday(#06/17/2020#);

Output :

4

Example-2 :

SELECT Weekday(Date());

Output :

5

2. WeekdayName() Function :
In MS Access, the WeekdayName() function returns the weekday name. In this function, the first function will be the week number and the second parameter will be abbreviate.it is optional. If you want abbreviation then pass true otherwise pass false. and the third parameter will be the first day of the week. It is also optional.

Syntax :

WeekdayName(number, abbreviate, firstdayofweek)

Parameters :

Parameter Description
number It is required. It will be in the range of 1 to 7
abbreviate Optional.For abbreviation true otherwise false
firstdayofweek optional, it will specifies the first day of the week
0 : For NLS API setting
1 : Sunday (default)
2 : Monday
3 : Tuesday
4 : Wednesday
5 : Thursday
6 : Friday
7 : Saturday

Example-1 :

SELECT WeekdayName(1);

Output :

Sunday

Example-2 :

SELECT WeekdayName (3, TRUE, 2)

Output :

Wed

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads