Skip to main content

Description

Formats a date/time value using a simple token-based pattern. Supports common date/time tokens and optional timezone offset adjustment.

Syntax

Parameters

Supported Pattern Tokens

Returns

Type: string A formatted date/time string according to the pattern. Returns null if the input date is invalid.

Examples

Example 1: Basic Date Formatting

Output:

Example 2: Full DateTime with Time

Output:

Example 3: Custom Format with Timezone

Output:
(Adjusted for +02:00 timezone)

Example 4: Formatting Node Timestamps

Notes

  • Returns null for invalid date inputs
  • Default pattern is ISO8601-like: 'YYYY-MM-DDTHH:mm:ss[Z]'
  • Timezone parameter adjusts the displayed time for the given offset
  • All calculations are UTC-based internally
  • Milliseconds are optional in the pattern

See Also

Frequently Asked Questions

Common tokens include yyyy (year), MM (month), dd (day), HH (hour), mm (minute), ss (second). The function uses token-based pattern formatting.
Yes. Pass an optional timezone offset parameter to adjust the output before formatting.