WEEKDAY
- WEEKDAY(date, return_type=None)[source]
Returns the day of the week for a given date, using a customizable numbering scheme.
This function calculates the weekday for each date in date or a single date. The numbering of the days is determined by return_type, following conventions similar to Excel’s WEEKDAY function.
- Parameters:
- Return type:
- Returns:
A formula representing the weekday(s).
- Raises:
ValueError – If date is not DATE or DATE_ARRAY, or if return_type is outside the allowed range or of invalid type and is determinable at compile time.
Examples
Default numbering (Sunday=1 through Saturday=7):
WEEKDAY(DATE("2025-09-03")) # Returns 4 (Wednesday)
Monday=1 through Sunday=7:
WEEKDAY(DATE("2025-09-03"), 2) # Returns 3 (Wednesday)
Monday=0 through Sunday=6:
WEEKDAY(DATE("2025-09-03"), 3) # Returns 2 (Wednesday)
Note
The return type follows the same format as Excel’s WEEKDAY function. For details see: <https://support.microsoft.com/en-us/office/ weekday-function-60e44483-2ed1-439f-8bd0-e404c190949a>
``date`` — accepted types
DATE
DATETIME
DATETIME_ARRAY
DATE_ARRAY
``return_type`` (optional) — accepted types
DECIMAL
DECIMAL_ARRAY
INTEGER
INTEGER_ARRAY
Return types
INTEGER
INTEGER_ARRAY