Oracle FROM_TZ

The Oracle FROM_TZ() function converts a timestamp and a time zone to value with the type of TIME STAMP WITH TIME ZONE.

Syntax

The following illustrates the syntax of the FROM_TZ() function:

FROM_TZ (timestamp, timezone)
Code language: SQL (Structured Query Language) (sql)

Arguments

The Oracle FROM_TZ() function requires two arguments:

1) timestamp

The timestamp is a TIMESTAMP value which should be converted to a TIME STAMP WITH TIME ZONE value.

2) timezone

The timezone is a character string in the format TZH:TZM e.g., -08:00 or a character expression that evaluates to a string in TZR with optional TZD format.

Return value

The Oracle FROM_TZ() function returns a TIMESTAMP WITH TIME ZONE value.

Examples

The following example shows how to convert a timestamp and a time zone to a TIMESTAMP WITH TIME ZONE value:

SELECT
  FROM_TZ(TIMESTAMP '2017-08-08 08:09:10', '-07:00')
FROM
  DUAL;
Code language: SQL (Structured Query Language) (sql)

Here is the returned value:

08-AUG-17 08.09.10.000000000 AM -07:00
Code language: SQL (Structured Query Language) (sql)

In this tutorial, you have learned how to use the Oracle FROM_TZ() function to create a TIMESTAMP WITH TIME ZONE value from a timestamp and a time zone.

Was this tutorial helpful?