Change timestamp time zone

Supported in: Batch

Changes the time zone of a timestamp.

Expression categories: Datetime

Declared arguments

  • Output time zone - Target time zone.
    TimeZone
  • Timestamp - Timestamp column.
    Expression<Timestamp>
  • optional Input time zone - Time zone that the current timestamp is recorded in.
    Expression<String>

Output type: Timestamp

Examples

Example 1: Base case

Argument values:

  • Output time zone: America/Chicago
  • Timestamp: 2020-04-28T05:09:00Z
  • Input time zone: US/Eastern

Output: 2020-04-28T04:09:00Z


Example 2: Base case

Argument values:

  • Output time zone: Australia/Sydney
  • Timestamp: timestamp
  • Input time zone: time_zone
timestamptime_zoneOutput
2020-04-28T10:09:00ZUS/Eastern2020-04-29T00:09:00Z
2020-04-28T10:09:00ZUTC2020-04-28T20:09:00Z

Example 3: Null case

Argument values:

  • Output time zone: US/Eastern
  • Timestamp: 2020-04-28T10:09:00Z
  • Input time zone: null

Output: 2020-04-28T06:09:00Z


Example 4: Null case

Argument values:

  • Output time zone: Australia/Sydney
  • Timestamp: timestamp
  • Input time zone: time_zone
timestamptime_zoneOutput
nullUS/Easternnull
nullnullnull
2020-04-28T10:09:00Znull2020-04-28T20:09:00Z