Skip to main content

dateFormat (Function)

Formats the data in string or milliseconds format to the given date format.

Syntax

<STRING> time:dateFormat(<STRING> date.value, <STRING> date.target.format, <STRING> date.source.format)
<STRING> time:dateFormat(<STRING> date.value, <STRING> date.target.format)
<STRING> time:dateFormat(<LONG> timestamp.in.milliseconds, <STRING> date.target.format)

Query Parameters

NameDescriptionDefault ValuePossible Data TypesOptionalDynamic
date.valueThe value of the date. For example, 2014-11-11 13:23:44.657, 2014-11-11, 13:23:44.657.-STRINGYesYes
date.target.formatThe format of the date into which the date value needs to be converted. For example, yyyy/MM/dd HH:mm:ss.STRINGNoYes
date.source.formatThe format input date.value.For example, yyyy-MM-dd HH:mm:ss.SSS.yyyy-MM-dd HH:mm:ss.SSSSTRINGYesYes
timestamp.in.millisecondsThe date value in milliseconds from the epoch. For example, 1415712224000L.-LONGYesYes

Example 1

time:dateFormat('2014/11/11 13:23:44', 'mm:ss', 'yyyy/MM/dd HH:mm:ss')

Converts date based on the target date format mm:ss and returns 23:44.

Example 2

time:dateFormat('2014-11-11 13:23:44', 'HH:mm:ss')

Converts date based on the target date format HH:mm:ss and returns 13:23:44.

Example 3

time:dateFormat(1415692424000L, 'yyyy-MM-dd')

Converts date in millisecond based on the target date format yyyy-MM-dd and returns 2014-11-11.