Built-in Functions → weekday
weekday() is a scalar date function that returns the day number of the week from a date or time string. The function returns an integer associated with the day of the week, with 1 representing Sunday.
Signature
weekday(date exp)
The following table illustrates the weekday() parameter:
Parameter | Description |
---|---|
date exp | an expression evaluating to a timestamp or date |
Returns
int
Example
Return the day number from July 7, 2014 at midnight.
weekday(timestamp("2014-07-07 00:00:00"))
This example returns 2 for Monday.