Articles in this section

dateFormat helper

Use {{dateFormat}} to format a date/time string into a desired output format, optionally specifying how the input is formatted and which time zone to apply.

Usage

{{dateFormat oFormat date iFormat timezone}}
  • oFormat (Output Format): The format you want for the final date/time (e.g., "MM-DD-YYYY HH:mm", "YYYY-MM-DDTHH:mm:ssZ").

  • date: The date to transform (e.g., record.orderDate or a string like "1966-25-05 18:36").

  • iFormat (Input Format, optional): The format of the passed-in date if it’s not in standard ISO or another automatically recognized format (e.g., "YYYY-DD-MM HH:mm").

  • timezone (optional): A valid time zone ID (e.g., "America/Los_Angeles"). If used with a "Z" in oFormat, the output includes the corresponding time zone offset.

Note

Examples

  1. Format an ISO date to US style

    {{dateFormat "MM-DD-YYYY hh:mm A" record.orderDate}}
    

    If record.orderDate is "2025-03-26T12:34:56Z", the output might be "03-26-2025 12:34 PM".

  2. Reinterpreting custom input format

    {{dateFormat "MM-DD-YYYY hh:mm" record.orderDate "YYYY-DD-MM HH:mm"}}
    

    If record.orderDate is "1966-25-05 18:36", where the day is in the middle, this outputs "05-25-1966 18:36".

  3. Applying time zone and offset

    {{dateFormat "YYYY-MM-DDTHH:mm:ssZ" record.orderDate "" "Asia/Hong_Kong"}}
    

    Converts record.orderDate to Hong Kong time, displaying the offset in the final string (e.g., +08:00).

Tip

  • Common tokens include YYYY (year), MM (month), DD (day), HH or hh (hour), mm (minute), ss (seconds), A or a (AM/PM), and Z (time zone offset).

  • If the date doesn’t match a known format, use iFormat to specify how to parse it. Omit iFormat for standard ISO 8601 inputs.

  • When including "Z" in oFormat, the offset reflects the provided timezone if one is specified. If not, it defaults to UTC.

  • Time zone IDs follow IANA naming (e.g., "America/New_York", "Europe/London").