DateTime addYears
DateTime_addYears
Add years to a datetime
Syntax
DateTime_addYears(date , numberOfYears);
Arguments
- date: is an array which is the original date time
- numberOfYears: is a number type
Return value
array which is the datetime after adding
Index |
Data type |
Value |
DateTime_Year |
number |
Value after the calculation |
DateTime_Month |
number |
Value after the calculation |
DateTime_Day |
number |
Value after the calculation |
DateTime_Hour |
number |
Value after the calculation |
DateTime_Minute |
number |
Value after the calculation |
DateTime_Second |
number |
Value after the calculation |
DateTime_Millisecond |
number |
Value after the calculation |
DateTime_Week |
number |
Value after the calculation |
DateTime_TimeZone |
number |
Value of input date time object array |
Example
number n = 4;
array a1 = {2005,6,15,0,0,0,0,33,40}; //getCurrentDateTime();
array a2 = DateTime_addYears(a1,n);
print(a2);
// a2 ={2009,6,15,0,0,0,0,25,40}
Availability
Version 5.7