getTime
Table of Contents
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,
Parameter | Data type | Description |
<variable> | TEXT | Variable which will contain the formatted date value. |
<dateTimeValue> | DATE-TIME/TEXT | The value which has to be formatted. |
<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