Creator Help

getHour

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

Description

Returns the hour of a time value. The hour is given as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).

Syntax

.getHour()

(or)

hour(time)

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

The getHour function syntax has the following arguments.

datetime - Required. The datetime that contains the hour you want to find. The time specified can be a date-time field, the "now" variable which represents the current time, or results of other date-time functions, for example, date.totime()

Example


//the "now" variable which returns the current time is specified as input to the hour function.
hour = now.getHour();

//the form field named "Date_Time" is used as input to the hour function. This field is a date-time field.
hour = input.Date_Time.getHour();

// the input is the result of a date-time string converted to time, using the toTime() function.
datetime = "04-Jul-2013 16:01:46";
time = datetime.toTime();
hour = time.getHour();

//the "now" variable which returns the current time is specified as input to the hour function.hour = hour(now);

// Here, the form field named "Date_Time" is used as input to the hour function. This field is a date-time field.
hour = hour(input.Date_Time);

// the input is the result of a date-time string converted to time, using the toTime() function.
datetime = "04-Jul-2013 16:01:46";
time = datetime.toTime();
hour = hour(time);

Top