Choose where you’d like to start

getTime

Overview

The getTime function takes a date-time or text value as an argument, and returns a formatted time value in a presentable format.

Note:

  • This function returns the formatted time as a text value.

Return Type

Syntax

<variable> = <dateTimeValue>.getTime([<format>], [<show_seconds>]);

(OR)

<variable> = getTime(<dateTimeValue>, [<format>], [<show_seconds>]);

where,

ParameterData typeDescription
<variable>TEXTVariable which will contain the formatted date value.
<dateTimeValue>DATE-TIME/TEXT

The value which has to be formatted.

Note

  • In services other than Zoho Creator, the value of this parameter can be entered either as a text or as a date-time value.
  • In Zoho Creator, the value of this parameter can be entered only as a date-time value.

<format>

(optional)

NUMBER

The format in which the time value must be represented. 12 for 12-hour format and 24 for 24-hour format. Takes 12-hour format by default if not specified.

<show_seconds>

(optional)

BOOLEAN

A value of true displays seconds (if present in the source text or date). A value of false hides seconds. Takes false by default if not specified.

Examples

 currentDate = '17-Jan-2018 10:10:37';
 info currentDate.getTime(12, true); // Returns 10:10:37 AM
 currentDate = '17-Jan-2018 09:00:59';
 info currentDate.getTime(); // Returns 09:00 AM

Get Started Now

Execute