HomePrivacy PolicyFeedbackLink to usSite Map

MS Access: WeekdayName Function


In Access, the WeekdayName function returns a string representing the day of the week given a number from 1 to 7.

The syntax for the WeekdayName function is:

WeekdayName ( number, [abbreviate], [firstdayofweek] )

number is a value from 1 to 7, representing a day of the week.

abbreviate is optional. This parameter accepts a boolean value, either TRUE or FALSE. If this parameter is set to TRUE, it means that the weekday name is abbreviated. If this parameter is set to FALSE, the weekday name is not abbreviated.

firstdayofweek is optional. It determines what day is to be the first day of the week. It can be any of the following values:

Constant Value Explanation
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

If this parameter is omitted, the Weekday function assumes that the first day of the week is Sunday.

Please note that if you use the Weekday function in a query, you'll have to use the numeric value (ie: 0 to 7) for the firstdayofweek parameter. You can only use the constant equivalent (ie: vbSunday to vbSaturday) in VBA code.


For example:

WeekdayName (3) would return 'Tuesday'
WeekdayName (3, TRUE) would return 'Tue'
WeekdayName (3, TRUE, vbMonday) would return 'Wed'
WeekdayName (3, TRUE, 2) would return 'Wed'

VBA Code

The WeekdayName function can be used in VBA code. For example:

Dim LValue As String

LValue = WeekdayName (3, TRUE, vbMonday)

In this example, the variable called LValue would now contain the value of 'Wed'.


SQL/Queries

You can also use the WeekdayName function in a query.