Purpose
You can call this function to convert a string into a TIMESTAMP WITH TIME ZONE value with time zone information.
Syntax
TO_TIMESTAMP_TZ (char,[fmt],['nlsparam'])
Parameters
| Parameter | Description |
|---|---|
| char | An expression of the CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type. |
| fmt | (Optional) Specifies the format of char. If fmt is omitted, char must use the default format of the TIMESTAMP WITH TIME ZONE data type. |
| nlsparam | (Optional) Specifies the language used for the month and day returned. |
Return types
This function returns the TIMESTAMP WITH TIME ZONE data type.
Examples
Convert the string 2021-11-11, 11:11:11.11 to the TIMESTAMP WITH TIME ZONE type.
obclient> SELECT TO_TIMESTAMP_TZ ('2021-11-11 11:11:11.11', 'YYYY-MM-DD HH24:MI:SS.FF')
FROM DUAL;
+--------------------------------------------------------------------+
TO_TIMESTAMP_TZ('2021-11-1111:11:11.11','YYYY-MM-DDHH24:MI:SS.FF')
+--------------------------------------------------------------------+
11-NOV-21 11.11.11.110000000 AM +08:00
+--------------------------------------------------------------------+
1 row in set