• Skip to primary navigation
  • Skip to main content

Tech Honey

The #1 Website for Oracle PL/SQL, OA Framework and HTML

  • Home
  • HTML
    • Tags in HTML
    • HTML Attributes
  • OA Framework
    • Item in OAF
    • Regions in OAF
    • General OAF Topics
  • Oracle
    • statement
    • function
    • clause
    • plsql
    • sql
You are here: Home / Oracle / function / Oracle TO_TIMESTAMP_TZ Function

Oracle TO_TIMESTAMP_TZ Function

November 2, 2012 by techhoneyadmin

Oracle To_TimeStamp_Tz FunctionOracle TO_TIMESTAMP_TZ Function is used to convert string type to time stamp type along with the time zone.


Oracle TO_TIMESTAMP_TZ Function Syntax

SELECT TO_TIMESTAMP_TZ(string_value, [FORMAT_MASK],[NLS_LANGUAGE])
FROM table_name;

In the above Oracle TO_TIMESTAMP_TZ Function Syntax

  • STRING_VALUE is the value that will be converted into date format.
  • FORMAT_MASK is an optional field, if present; it is used to convert value into time stamp.
  • NLS_LANGUAGE is also an optional field, if present; it is used to convert value into time stamp.

Oracle TO_TIMESTAMP_TZ Function – Use with SQL Select SELECT Statement Example

Oracle TO_TIMESTAMP_TZ Function is used with the SQL SELECT Statement.

For example the below SQL query converts string type to time stamp type along with the time zone.

SELECT TO_TIMESTAMP_TZ('2012-11-01 07:15:31.1234 PST', 'YYYY-MM-DD HH24:MI:SS.FF TZR')
FROM dual;

Will return “11/1/2012 7:15:31.123400000 AM -08:00”


Oracle TO_TIMESTAMP_TZ Function – Using with SQL SELECT Statement Example

The below Oracle TO_TIMESTAMP_TZ query converts string type to time stamp type along with the time zone.

SELECT TO_TIMESTAMP_TZ('2012-11-01 07:15:31.1234+5:30', 'YYYY-MM-DD HH24:MI:SS.FF TZH:TZM')
FROM dual;

Will return “11/1/2012 7:15:31.123400000 AM +05:30”


Filed Under: function Tagged With: how to convert string type to timestamp type in oracle sql plsql, How to use oracle sql plsql TO_TIMESTAMP_TZ function with example, TOTIMESTAMPTZPLSQL, What is oracle plsql TO_TIMESTAMP_TZ function

Copyright © 2023 · Parallax Pro on Genesis Framework · WordPress · Log in