WEEKDAY
Use the WEEKDAY function to return the day of the week for a given date. The day is a number ranging from 1 (Sunday) to 7 (Saturday).
Use
WEEKDAY( date [, timezone] )
Returns the day of the week of a date or date/time ranging from 1 (Sunday) to 7 (Saturday).
| Parameter | Required | Description |
|---|---|---|
| date | Yes | date of the day to return |
| timezone | No | the dates timezone or locale default if omitted |
| Returns | Number |
Examples
Restricting Form Submissions to Business Days (Output Validation)
You can use WEEKDAY in an Output Validation formula to ensure that users only select valid working days for tasks like office visits or delivery requests.
- Scenario: A "Facility Access" trigger form requires users to select a
VisitDate. The facility is closed on weekends, so the form must reject any Saturday or Sunday selections. - Formula:
ASSERT(AND(WEEKDAY(this) >= 2, WEEKDAY(this) <= 6), "The selected date must be a weekday (Monday through Friday)."). - Logic:
this: Refers to the date value entered by the user.WEEKDAY(this): Converts that date into a number (1–7).- Result: If the user picks a Monday (2) through Friday (6), the formula returns TRUE and the submission proceeds. If they pick Sunday (1) or Saturday (7), the ASSERT function displays the custom error message.
Routing Approvals Based on the Current Day (Conditional Assignment)
You can use WEEKDAY in an Assignment formula to automatically change who is responsible for a task based on the day of the week the approval is running.
- Scenario: An "Emergency Maintenance" activity needs to be assigned to the "On-Call Engineers" group if it is triggered on a weekend; otherwise, it should go to the standard "Facility Manager".
- Formula:
IF(OR(WEEKDAY(TODAY()) = 1, WEEKDAY(TODAY()) = 7), {'group:On-Call Engineers'}, {'person:Adele Vance'}). - Logic:
TODAY(): Retrieves the current date.WEEKDAY(...): Checks if today's numeric value is 1 (Sunday) or 7 (Saturday).{...}: Uses curly braces to return the required Person Array data type for assignments.- Result: The system evaluates the current day and assigns the activity to the correct person or group automatically.
Pro Tip: Remember that Sunday is 1 and Saturday is 7. If you are working across different regions, you can use the optional timezone parameter to ensure the day is calculated relative to a specific locale's current time rather than the system default.