DAY OF Function
The DAY OF function returns a number value (1 to 31) for the day portion of the date you specify.
You can use this function when you need to use the day portion of a date in a calculation or comparison. It can also be useful when constructing a date value using the DATE OF function where the day is based on the day of a Date variable.
Function name |
DAY OF |
Usage model | DAY OF ( d:DATE ) |
Parameters | This function requires you to replace only one parameter: |
d: DATE |
The function returns the day portion of this date value. |
Result | A number value. |
Example
A company's benefits plan specifies that employees who start on the first day of a month may begin accruing paid time off (PTO) immediately; otherwise, employees must wait until the first day of the following month. The following computation script uses the DAY OF function to return the date when PTO begins to accrue:
IF DAY OF ( HireDate ) = 1 HireDate ELSE DATE OF( 1, MONTH OF( HireDate + 1 MONTHS ), YEAR OF( HireDate + 1 MONTHS ) ) END IF
If the hire date is not on the first day of the month, the script uses DATE OF, MONTH OF, and YEAR OF functions to calculate the first day of the month after the hire date.