Returns the day of the week (1 through 7) for the specified date. By default, the function starts counting on Sunday (1 = Sunday, 2 = Monday, and so on). For example, the function returns:
- 1 for Sunday, January 1, 2012
- 2 for Monday, December 31, 2012
Syntax
weekday(date, [week_start_day])
-
date
can be any of the following:- Another function that returns a date.
- A formula column that returns a date.
-
week_start_day
(optional): A number indicating whether weeks start on Sunday or Monday. Valid values are:1
: (default) Days are counted from Sunday. The value of Sunday is 1, and the value of Saturday is 7.2
: Days are counted from Monday. The value of Monday is 1, and the value of Sunday is 7.
Examples
- If today is Sunday, January 1, 2012 the following function returns 1:
weekday(today())
- If December 31, 2013 is a Tuesday, The following function returns 3:
weekday(date(2013,12,31))
- The following function returns 2:
weekday(date(2013,12,31), 2)
- If c:"specialDay" is a formula column that specifies Thursday, October 1, 2015, the following function returns 5:
weekday(c:"specialDay")