totn Oracle Functions

Oracle / PLSQL: FROM_TZ function

This Oracle tutorial explains how to use the Oracle/PLSQL FROM_TZ function with syntax and examples.

Description

The Oracle/PLSQL FROM_TZ function converts a TIMESTAMP value (given a TIME ZONE) to a TIMESTAMP WITH TIME ZONE value.

Syntax

The syntax for the FROM_TZ function in Oracle/PLSQL is:

FROM_TZ( timestamp_value, time_zone_value )

Parameters or Arguments

timestamp_value
The value to convert to a TIMESTAMP WITH TIME ZONE value.
time_zone_value
The time zone used to convert timestamp_value to a TIMESTAMP WITH TIME ZONE value.

Returns

The FROM_TZ function returns a TIMESTAMP WITH TIME ZONE value.

Applies To

The FROM_TZ function can be used in the following versions of Oracle/PLSQL:

  • Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i

Example

Let's look at some Oracle FROM_TZ function examples and explore how to use the FROM_TZ function in Oracle/PLSQL.

For example:

If you executed the following SQL statement:

select FROM_TZ(TIMESTAMP '2005-09-11 01:50:42', '5:00')
from dual;

You would now get the following result:

11-Sep-05 01.50.42.000000 AM +05:00

If you executed the same SQL statement, but set the time zone to '-7:00' as follows:

select FROM_TZ(TIMESTAMP '2005-09-11 01:50:42', '-7:00')
from dual;

You would now get the following result:

11-Sep-05 01.50.42.000000 AM -07:00