getDateTime
Table of Contents
Overview
The getDateTime function takes a date-time or text value as an argument, and returns a formatted date-time value in a presentable format.
Note:
- This function returns the formatted date-time as a text value.
Return Type
Syntax
<variable> = <dateTimeValue>.getDateTime([<format>], [<show_seconds>]);
(OR)
<variable> = getDateTime(<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 date-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.getDateTime(12, true); // Returns 17th January 2018,10:10:37 AM
currentDate = '17-Jan-2018 09:00:59'; info currentDate.getDateTime(); // Returns 17th January 2018,09:00 AM