WeekdayName
Returns a string indicating the specified day of the week.
Syntax
WeekdayName(Val [, Abbreviate [, Locale ] ])
Parameters
Val
Type: None
A integer between 1 and 7 representing the day of the week, or a date. The input locale defines which days are considered the first and last days of the week.
Abbreviate
Type: Boolean
Optional. Whether a short form of the day name is to be used. The default is False.
Locale
Type: Long
Optional. The output locale to use for regional variations in day names. If Locale is omitted or negative, or does not match a known Locale ID (LCID), the current output locale is used.
(return)
Type: Text
The name of the day, as specified for the output locale.
Remarks
If Locale is specified, it is not used for error messages.
If Val is NULL, the return value is a zero-length string. Otherwise, an error occurs if Val is not in the range 1 to 7 or is not a valid date.
Examples
This example uses the WeekdayName function to return the full name of the third day of the week. If the first day of the week is defined as Sunday, this example would return “Tuesday”.
WeekdayName(3)
To return the abbreviated weekday name, set Abbreviate to True. If the first day of the week is defined as Sunday, this example would return “Tue”.
WeekdayName(3, True)
To return the day name for a specific locale, set Locale to a Locale ID (LCID) number. In the following example, the Arabic name for the 4th day is returned.
WeekdayName(4, , 1025)
The following SQL query uses the WeekdayName function to return the name of the day on which interviews were completed:
SELECT Respondent.Serial,
DataCollection.FinishTime,
WeekdayName(DataCollection.FinishTime) AS Day
FROM vdata
WHERE DataCollection.Status = {Completed}
Here are the results for the first five respondents:
Respondent.Serial DataCollection.FinishTime Day
----------------- ------------------------- -----------
6 16/10/2002 13:57:03 Wednesday
7 16/10/2002 18:23:12 Wednesday
8 16/10/2002 22:23:47 Wednesday
9 17/10/2002 02:24:05 Thursday
10 17/10/2002 06:24:00 Thursday
See also