subYear
This topic describes the syntax and usage of the subYear function in Zoho Creator .
Description
The subYear function returns a date-time value after subtracting the specified number of years.
Syntax
<date-time>.subYear(int)
(or)
subYear(date-time, int)
// this format is supported only in the free flow scripting mode of Script builder.
The subYear function syntax has the following arguments.
date-time - Required. The date-time value from which you are subtracting the specified number of years. Date-Time should be a date-time field type or as results of toTime() function.
int - Required. The number of years to be subtracted from the date-time value.
Example
datetime = "Aug 21, 2013 16:04:37";
time = datetime.toTime();
meetingTime=time.subYear(3) // returns Aug 21, 2010 16:04:37
meetingTime=input.Date_Time.subYear(2); // here, input.Date_Time refers to the date-time field in the form.
time = datetime.toTime();
meetingTime=time.subYear(3) // returns Aug 21, 2010 16:04:37
meetingTime=input.Date_Time.subYear(2); // here, input.Date_Time refers to the date-time field in the form.
datetime = "Aug 21, 2013 16:04:37";
time = datetime.toTime();
meetingTime=subYear(time, 3) // returns Aug 21, 2010 16:04:37
meetingTime=subYear(input.Date_Time, 2); // here, input.Date_Time refers to the date-time field in the form.
time = datetime.toTime();
meetingTime=subYear(time, 3) // returns Aug 21, 2010 16:04:37
meetingTime=subYear(input.Date_Time, 2); // here, input.Date_Time refers to the date-time field in the form.
