Format timestamp as string

Supported in: Batch, Streaming

Returns the timestamp as ISO8601 formatted string.

Expression categories: Cast, Datetime, String

Declared arguments

  • Timestamp - The timestamp to convert to a string.
    Expression<Timestamp>
  • optional Format - The format to use, defaults to ISO8601.
    Literal<String>
  • optional Time zone - Defaults to UTC.
    TimeZone

Output type: String

Examples

Example 1: Base case

Argument values:

  • Timestamp: 2022-10-01T09:00:00Z
  • Format: yyyy-MM-dd
  • Time zone: null

Output: 2022-10-01


Example 2: Base case

Argument values:

  • Timestamp: 2022-10-01T09:00:00Z
  • Format: yyyy-MM-dd-hh-mm-ss
  • Time zone: EST

Output: 2022-10-01-04-00-00


Example 3: Null case

Argument values:

  • Timestamp: null
  • Format: yyyy-MM-dd
  • Time zone: UTC

Output: null