yearsDiff()
Table of Contents
Overview
The yearsDiff() function takes startDateTimeValue and endDateTimeValue as arguments. It returns the number of years between the given date-time values.
Return Type
Syntax
(OR)
Parameter | Data type | Description |
---|---|---|
<variable> | NUMBER | Variable which will contain the returned number. |
<startDateTimeValue> | DATE TIME | The starting date-time value. |
<endDateTimeValue> | DATE TIME | The ending date-time value. |
A runtime error will be encountered if:
- the date value exceeds the number of days in that month.
- an incorrect month value is specified.
- the year value has more than 4 digits.
- Please refer this help document to learn about the supported date-time formats.
Examples
endDate = '31-Dec-2019';
newStartDate = '1-Jan-2019';
newEndDate = '1-Jan-2020';
numberOfYears= yearsDiff(startDate, endDate); // returns 0
numOfYears = yearsDiff(newStartDate, newEndDate); // returns 1