ADD_YEARS
Description
This function is used to calculate and return the date after adding (or subtracting) a specified number of years (numYears) to a given start date (startDate). If the calculated result exceeds the date range supported by the system, it will return null.
Parameter Description
- startDate: Type date, represents the start date for the calculation.
- numYears: Type int, represents the number of years to add or subtract, can be positive or negative.
Return Result
Returns a date type date, representing the calculated result.
Usage Example
- Calculate a future date:
- When the added years cause the result to exceed the system date range, return null:
Precautions
- Ensure that the input startDate parameter is in a valid date format, otherwise it may lead to inaccurate calculation results.
- When numYears is a negative number, it indicates calculating the corresponding number of years backward from the start date.
- If the calculation result exceeds the date range supported by the system, the function will return null. Please handle this situation accordingly.