subDay()
Table of Contents
Overview
The subDay() function takes dateTimeValue and numberOfDays as arguments. It returns the dateTimeValue after subtracting the specified number of days from it.
The date-time value will be returned in the format specified in Application Settings.
Return Type
- Date-Time
Syntax
(OR)
Parameter | Description | Data type |
---|---|---|
<variable> | Variable which will contain the returned date-time value. | DATE-TIME |
<dateTimeValue> | The date-time value from which the specified number of days will be subtracted. The date-time value can be specified without a time value, in which case 00:00:00 will be taken as the default time value. If the hour value is specified as 24 or more, the date-time value be reset to 00:00:00. If the minutes value is specified as 60 or more, the mm:ss value will be reset to 00:00, if the seconds value is specified as 60 or more, the ss value will be reset to 00. A runtime error will be encountered if:
Refer this help document to learn about the supported date-time formats. | DATE-TIME |
<numberOfDays> | The number of days to be subtracted from dateTimeValue. A negative number will add the specified number of days to dateTimeValue. | NUMBER |
Examples
newDate = currentDate.subDay(1); // returns '31-Dec-2018 00:00:00'