Skip to main content

Dates and Times

dateFormat​

Formats Java Date or TemporalAccessor values.

{{dateFormat createdAt "yyyy-MM-dd"}}

Example output:

2026-05-15

Predefined date styles (no explicit locale):

{{dateFormat createdAt "short"}}
-> For example, 2019-09-02
{{dateFormat createdAt "medium"}}
-> 2019 Sep 2
{{dateFormat createdAt "long"}}
-> 2019 September 2
{{dateFormat createdAt "full"}}
-> 2019 September 2, Monday
{{dateFormat createdAt "yyyy-MM-dd"}}
-> 2012-06-19 // a java.time.format.DateTimeFormatter pattern.

Locale and timezone:

{{dateFormat createdAt "full" locale="en_US" tz="Asia/Ho_Chi_Minh"}}

Include time:

{{dateFormat createdAt "short" time='short' locale='de-DE'}}
-> For example, 02.09.19, 18:28
{{dateFormat createdAt "medium" time='medium' locale='de-DE'}}
-> 02.09.2019, 18:28:39
{{dateFormat createdAt "long" time='long' locale='de-DE'}}
-> 2. September 2019, 18:28:39 MESZ
{{dateFormat createdAt "full" time='full' locale='de-DE'}}
-> Montag, 2. September 2019, 18:28:39 Mitteleuropäische Sommerzeit

dateTimeFormat​

Formats date values as timestamps using the output format.

Input can be any either Long (milliseconds since epoch) or String (date/time string in a format specified by the input parameter).

Syntax:

{{dateTimeFormat date ["format"]
[output="format"]
[locale="locale"]
[tz=timeZone|timeZoneId]
[input="format"] }}

Usage:

{{dateTimeFormat 'now' output='isoOffsetDateTime' tz='VTN'}}
→ 2026-04-27T00:28:57.85952+07:00
{{dateTimeFormat 'Fri, 21 Mar 2014 09:33:44 +0700' input='rfc1123DateTime' output='epochMillis'}}
→ 1395369224000

Input and output format parameters are any of:

  • basicIsoDate: DateTimeFormatter.BASIC_ISO_DATE, e.g., 20190903
  • epochMillis: milliseconds since Unix epoch started, e.g., 1567441719278
  • epochSeconds: seconds since Unix epoch started, e.g., 1567441719
  • isoDateTime: DateTimeFormatter.ISO_DATE_TIME, e.g., 2019-09-03T00:28:39.279+08:00[Asia/Singapore]
  • isoDate: DateTimeFormatter.ISO_DATE, e.g., 2019-09-03+08:00
  • isoInstant: DateTimeFormatter.ISO_INSTANT, e.g., 2019-09-02T16:28:39.280Z
  • isoLocalDateTime: DateTimeFormatter.ISO_LOCAL_DATE_TIME, e.g., 2019-09-03T00:28:39.278
  • isoLocalDate: DateTimeFormatter.ISO_LOCAL_DATE, e.g., 2019-09-03
  • isoLocalTime: DateTimeFormatter.ISO_LOCAL_TIME, e.g., 00:28:39.275
  • isoOffsetDateTime: DateTimeFormatter.ISO_OFFSET_DATE_TIME, e.g., 2019-09-03T00:28:39.278+08:00
  • isoOffsetDate: DateTimeFormatter.ISO_OFFSET_DATE, e.g., 2019-09-03+08:00
  • isoOffsetTime: DateTimeFormatter.ISO_OFFSET_TIME, e.g., 00:28:39.277+08:00
  • isoOrdinalDate: DateTimeFormatter.ISO_ORDINAL_DATE, e.g., 2019-246+08:00
  • isoTime: DateTimeFormatter.ISO_TIME, e.g., 00:28:39.278+08:00
  • isoWeekDate: DateTimeFormatter.ISO_WEEK_DATE, e.g., 2019-W36-2+08:00
  • isoZonedDateTime: DateTimeFormatter.ISO_ZONED_DATE_TIME, e.g., 2019-09-03T00:28:39.279+08:00[Asia/Singapore]
  • rfc1123DateTime: DateTimeFormatter.RFC_1123_DATE_TIME, e.g., Tue, 3 Sep 2019 00:28:39 +0800
  • pattern: a custom DateTimeFormatter pattern, e.g., `` -> Tue, 3 Sep 2019 00:28:39 +0800

Otherwise, the default formatter (isoInstant) will be used. The output format option can be specified as a parameter or hash (a.k.a. named parameter).

  • The "locale" parameter can be used to select a locale, e.g. "de" or "en_GB". It defaults to the env property DEFAULT_LOCALE (en-GB by default). This is applied only for output formatting. Input parsing always uses the default.
  • The "tz" parameter is the time zone to use, e.g. "Europe/Berlin" or "GMT-8:00". It defaults to the env property DEFAULT_TIMEZONE (UTC by default). This is applied only for output formatting. Input parsing always uses the default.

dateTimeParse​

Parses a string into a date/time value (millis since epoch without time zone). Useful when juggling with timezones.

Syntax:

{{dateTimeParse date ["format"] [input="format"] [locale="locale"] [tz=timeZone|timeZoneId] }}

Usage:

{{dateTimeParse 'Fri, 21 Mar 2014 09:33:44 +0700' input='rfc1123DateTime' }} → 1395369224000

For input format parameter see dateTimeFormat.

The default formatter is isoInstant. The input format option can be specified as a parameter or hash (a.k.a. named parameter).

  • The "locale" parameter can be used to select a locale, e.g. "de" or "en_GB". It defaults to the env property DEFAULT_LOCALE (en-GB by default).
  • The "tz" parameter is the time zone to use, e.g. "Europe/Berlin" or "GMT-8:00". It defaults to the env property DEFAULT_TIMEZONE (UTC by default).

now​

Formats the current date/time using the same options as dateTimeFormat.

{{now "yyyy-MM-dd"}}

With timezone:

{{now "yyyy-MM-dd HH:mm" tz="Asia/Ho_Chi_Minh"}}

With predefined style:

{{now "full" locale="en_US"}}