
Takes a date and returns a number 1 to 7 for the day-of-week number.
By default, WEEKDAY returns 1 for Monday, 2 for Tuesday, 3 for Wednesday, and so on. You can change the start day for the count by using the optional Type parameter.
Syntax
WEEKDAY(x,[y])
where:
- x: Date or date-formatted line item as source.
- y: (Optional) Type parameter.
Parameter | Sets the week start day to: |
1 | Monday (default) |
2 | Tuesday |
3 | Wednesday |
4 | Thursday |
5 | Friday |
6 | Saturday |
7 | Sunday |
Format
Input Format | Output Format |
---|---|
x: Time y: Type parameter |
Number (1-7) |
Arguments
The function uses the following arguments:
- x: Time: Date or date-formatted line item.
- [y]: Type parameter: 1 for Monday, 2 for Tuesday, 3, for Wednesday, and so on.
Constraints
The function has the following constraints:
- Source must be date or date-formatted line item.
- Result must be number-formatted.
- Type for start of day-of-week count is parameters 1 through 7.
Excel equivalent
Example
WEEKDAY is used to show the day of the week for a Cost & Sales Date date-formatted source line item, where no Type parameter is used. The day-of-week count starts on a Monday - Costs of Sales Date for Mar 12 is 30/03/12, which is a Friday. The function returns 5.
A second example modifies the first to designate Wednesday as the start day of the accounting week—Costs of Sales Date for Mar 12 is 30/03/12, which is a Friday. The function returns 3.