Purpose
This function converts a string to the TIMESTAMP WITH TIME ZONE data type, which includes time zone information.
Syntax
TO_TIMESTAMP_TZ (char,[fmt],['nlsparam'])
Parameters
Parameter |
Description |
|---|---|
| char | A string of the CHAR, VARCHAR2, NCHAR, or NVARCHAR2 data type. |
| fmt | The format of the char parameter. This is an optional parameter. If you omit fmt, the char parameter must be in the default format for the TIMESTAMP WITH TIME ZONE data type. |
| nlsparam | The language to use for the month and date in the returned value. This is an optional parameter. |
Return type
TIMESTAMP WITH TIME ZONE
Examples
Convert the string 2021-11-11 11:11:11.11 to the TIMESTAMP WITH TIME ZONE data 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
