Creator Help

getYear

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

Description

The getYear function returns the year corresponding to a date. The year is returned as an integer in the format  yyyy.

Syntax

<datetime>.getYear()

(or)

YEAR(date)

The getYear function syntax has the following arguments.

datetime - Required. The date of the year you are trying to find. The date can be a date or date-time field, the "today" variable which returns the current year, or results of other date functions, for example, datevalue()

Example

a. In this example, the date format specified in the application settings page is dd-MMM-yyyy. Hence the date text "05-20-13" is converted to date format as 20-May-2013. 

str = "05-20-13";
x = str.toDate();
year = x.getYear();   // the variable "year" returns the number 2013

year=input.Sale_Date.getYear();   // Here, the form field "Sale_Date" is used as input to the getYear function.

year=today.getYear();    //Here, the zoho variable "today" is used as input to the getYear function.

str = "05-20-13";
x = dateValue(str);
year = year(x);   // the variable "year" returns the number 20

year=year(input.Sale_Date);   // Here, the form field is used as input to the year function.

year=year(today);   // Here, the zoho variable "today" is used as input to the year function.

Top