16.20 - Example: Returning the Current Date for INTERVAL -'08:00' HOUR TO MINUTE - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2020-03-25
dita:mapPath
xzf1512079057909.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
kby1472250656485

This example assumes that the default format for DATE values is 'yy/mm/dd'. Consider the following statements:

   SET TIME ZONE INTERVAL '01:00' HOUR TO MINUTE;
   SELECT CURRENT_DATE AT TIME ZONE INTERVAL -'08:00' HOUR TO MINUTE;
   SELECT CURRENT_DATE AT INTERVAL -'08:00' HOUR TO MINUTE;
   SELECT CURRENT_DATE AT TIME ZONE INTERVAL -'08' HOUR;
   SELECT CURRENT_DATE AT INTERVAL -'08' HOUR;
   SELECT CURRENT_DATE AT TIME ZONE '-08:00';
   SELECT CURRENT_DATE AT '-08:00';
   SELECT CURRENT_DATE AT TIME ZONE '-8';
   SELECT CURRENT_DATE AT '-8';
   SELECT CURRENT_DATE AT TIME ZONE -8;
   SELECT CURRENT_DATE AT -8;
   SELECT CURRENT_DATE AT -8.0;

The above SELECT statements return the current date based on the time zone displacement, INTERVAL -'08:00' HOUR TO MINUTE. If the current timestamp at UTC is TIMESTAMP '2008-06-01 06:30:00.000000+00:00', these SELECT statements would return '08/05/31' as the date.

If the SELECT statement was specified without an AT clause or with an AT LOCAL clause, and the DBS Control flag TimeDateWZControl is enabled, the statement would return 
'08/06/01' as the current date based on the current session time and time zone displacement, INTERVAL '01:00' HOUR TO MINUTE. For example:

   SELECT CURRENT_DATE;
   SELECT CURRENT_DATE AT LOCAL;
SELECT CURRENT_DATE();
   SELECT CURRENT_DATE() AT LOCAL;

The date returned is not adjusted to account for the start or end of daylight saving time.