MS Access WeekdayName() Function
The WeekdayName()
function in MS Access returns the name of a day of the week, given a numerical representation of the day. This is useful for displaying days of the week in a more readable format or for performing operations based on the day of the week.
WeekdayName(): Definition and Usage
This function takes a number (1-7, where 1 is typically Sunday) representing the day of the week and optionally lets you specify whether to abbreviate the day name and which day starts the week. The default is to return the full day name, starting the week on Sunday.
Syntax
Syntax
WeekdayName(number, abbreviate, firstdayofweek)
Parameter Values
Parameter | Description |
---|---|
number |
A number (1-7) representing the day of the week (1 is usually Sunday). This is required. |
abbreviate (Optional) |
A Boolean value (True or False). True returns the abbreviated day name (e.g., "Sun"); False (default) returns the full name (e.g., "Sunday"). |
firstdayofweek (Optional) |
Specifies the first day of the week:
|
Examples
Getting the Full Weekday Name
This example shows how to get the full name of the third day of the week (typically Tuesday).
Syntax
SELECT WeekdayName(3);
Output
Tuesday
Getting the Abbreviated Weekday Name
This example retrieves the abbreviated weekday name for the third day of the week.
Syntax
SELECT WeekdayName(3, True);
Output
Tue
Getting the Abbreviated Weekday Name with Monday as First Day
This example shows getting the abbreviated name for the third day of the week, starting the week on Monday.
Syntax
SELECT WeekdayName(3, True, 2);
Output
Wed