invantive documentationpart of invantive cloud
Invantive Support ForumsLog In / Sign Up

NEW_TIME

Syntax

%%{init: {
  'theme': 'base',
  'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
  'themeVariables': {
    'fontSize': '11px',
    'fontFamily': 'Arial'
  }
}}%%
flowchart LR
    Start((START)) --> NEW_TIME[NEW_TIME]:::quoted
    NEW_TIME --> End((END))

Purpose

The NEW_TIME SQL function converts a date/time from one time zone to another time zone. The time zones can be specified using an Oracle-style abbreviation such as AST or PDT, a general abbreviation such as AEST, or an operating system time zone name. The supported time zones are listed in Time Zones.

Parameters:

  • Date (datetime): the date/time to convert.
  • From time zone (varchar2): the time zone the date/time is in, as described in Time Zones.
  • To time zone (varchar2): the time zone to convert the date/time to, as described in Time Zones.

Returns: the date/time converted to the new time zone as datetime. The outcome is the reading of the clock in the new time zone; like every date/time without a time zone, it is handed to a client marked as UTC.

Up to and including release 27.0, a conversion from a time zone other than UTC, such as AST, failed with an error, as did a new_time within another new_time.

Examples

The following example converts noon Atlantic Standard Time (UTC-4) to Alaska-Hawaii Standard Time (UTC-10):

select to_char(new_time(to_date('20260703120000', 'YYYYMMDDHH24MISS'), 'AST', 'HST'), 'YYYY-MM-DD HH24:MI:SS')

-------------------
2026-07-03 06:00:00

The following example converts midnight UTC to Australian Eastern Standard Time (UTC+10):

select to_char(new_time(to_date('2020-01-01T00:00:00Z'), 'UTC', 'AEST'), 'YYYY-MM-DD HH24:MI:SS')

-------------------
2020-01-01 10:00:00