DAY OF WEEK Function

The DAY OF WEEK function converts a Date variable's answer to a number between 1 and 7 corresponding to the day of the week the date falls on.

 

Function name DAY OF WEEK
Usage model DAY OF WEEK ( d:DATE )
Parameters This function requires you to replace only one parameter:

d: DATE

The function determines the day of the week that this date falls on.
Result A number value between 1 and 7, corresponding to the day of the week:
  • 1 = Sunday
  • 2 = Monday
  • 3 =Tuesday
  • 4 = Wednesday
  • 5 = Thursday
  • 6 = Friday
  • 7 = Saturday

Example

A template author wants to know whether a payment due date falls on a Saturday or Sunday. If it does, they move the payment due date to the following Monday. The following script shows how this works:

IF DAY OF WEEK( Payment Date ) = 7

Payment Date + 2 DAYS

ELSE IF DAY OF WEEK( Payment Date ) = 1

Payment Date + 1 DAYS

ELSE

Payment Date

END IF

Download

After you download the example template, you can import the template to any workspace to see this example code in action.