TO_TIMESTAMP_TZ

Syntax

TO_TIMESTAMP_TZ
(
  str  IN text,
  fmt  IN text
)
RETURNS timestamp with time zone;

Overview

This function converts the input string and format model into a timestamp with time zone (timestamptz) value.

Utilizes the PostgreSQL built-in to_timestamp function to parse a string according to the specified format and return the result as a timestamptz type.

Unlike Oracle, it doesn't accept date type variables in order to maintain type consistency.

Parameter

Parameter
Description

str

text type; Date/Time string to convert.

fmt

text type; Format model that indicates the format of the input string. (ex. 'YYYY-MM-DD HH24:MI:SSOF') For supported format models, refer to the PG official documentation.

Example

SELECT oracle.TO_TIMESTAMP_TZ('2023-06-01 12:34:56+09', 'YYYY-MM-DD HH24:MI:SSOF');

    to_timestamp_tz     
------------------------
 2023-06-01 12:34:56+09
(1 row)

Last updated