TO_TIMESTAMP_TZ is one of the vital Conversion functions of Oracle. It is used to convert a string to a timestamp with time zone. The TO_TIMESTAMP_TZ function is supported in the various versions of the Oracle/PLSQL, including, Oracle 12c, Oracle 11g, Oracle 10g and Oracle 9i.
Syntax:
TO_TIMESTAMP_TZ ( char, format_mask, nls_language )
Parameters:
char: It is used to specify the string to be converted.
format_mask: It is an optional parameter which is used to specify the format to be used for conversion.
nls_language: It is an optional parameter which is used to specify the nls language to be used for conversion.
Example:
TO_TIMESTAMP_TZ( '2019/06/28 10:16:28 -7:00', 'YYYY/MM/DD HH:MI:SS TZH:TZM') |
Output:
'28-JUN-19 10.16.28.000000000 AM -7:00'
Explanation:
Here, a string is converted to a timestamp with time zone value.