Creator Help

addYear

This topic describes the syntax and usage of the addYear function in Zoho Creator .

Description

The addYear function returns a date-time value after adding the specified number of Years. 

Syntax

<date-time>.addYear(int)

(or)

addYear(date-time, int)

// this format is supported only in the free flow scripting mode of Script builder.

The addYear function syntax has the following arguments.

date-time - Required. The date-time value to which you are adding the specified years. Date-Time should be a date-time field type or as results of toTime() function.

int - Required.  The number of years to be added to the date-time value. 

Example

datetime = "Aug 21, 2013 16:04:37";
time = datetime.toTime();

meetingTime=time.addYear(3)       // returns Aug 21, 2016 16:04:37
    

meetingTime=input.Date_Time.addYear(5);  // here, input.Date_Time refers to the date-time field in the form.

datetime = "Aug 21, 2013 16:04:37";
time = datetime.toTime();

meetingTime=addYear(time, 3)       // returns Aug 21, 2016 16:04:37
    

meetingTime=addYear(input.Date_Time, 5);  // here, input.Date_Time refers to the date-time field in the form.

Top