WEEKDAY
The function WEEEKDAY takes a date or a DateTime and returns a number indicating what day of the week the given date falls on.
This function takes either a single DateTime or a single date as input. It then returns a number indicating what day of the week the given date falls on. Count starts with 1 and Monday (that is, 1 represents Monday, 2 represents Tuesday, 3 represents Wednesday, et cetera).
Declaration
Parameters
datetime (type: DateTime) Any DateTime.
date (type: date) Any date.
Return Values
day (type: number) A number (1-7) indicating what day of the week is described by the given date or DateTime. Count starts with 1 and Monday (that is, 1 represents Monday, 2 represents Tuesday, 3 represents Wednesday, et cetera).
Examples
Assume the first example has access to the following DateTime value:
The date described in example_date_and_time is April 1st, 2021. This falls on a Thursday, which WEEKDAY indexes as 4. Thus, in the following example, when example_date_and_time is given as input for WEEKDAY, it returns the number 4:
The above example demonstrates how the WEEKDAY function behaves when given a DateTime as input. In order to further establish how the WEEKDAY function behaves when given a date as input, assume the last example has access to the following date value:
Note that the date described in example_date is identical to the date described in example_date_and_time. This is still a Thursday, when example_date is given as input for WEEKDAY, it returns the number 4:
Last updated