TO_TIMESTAMP_TZ

2024-06-28 05:30:31  Updated

Purpose

TO_TIMESTAMP_TZ() converts a string to a value of the TIMESTAMP WITH TIME ZONE data type.

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 char. This parameter is optional. If you do not specify fmt, char must be in the default format of the TIMESTAMP WITH TIME ZONE data type.
nlsparam The custom formatting and parsing rules for date, time, and number values in the TO_TIMESTAMP_TZ() function. OceanBase Database currently supports nls_date_language, the language in which month and day names are returned, as nlsparam. The default value is AMERICA and cannot be modified.

Return type

The return type is TIMESTAMP WITH TIME ZONE.

Examples

The following example converts the string 2021-11-11 11:11:11.11 to a value of 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

Contact Us