17.10 - Gregorian Calendar Rules - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Date and Time Functions and Expressions

Advanced SQL Engine
Teradata Database
Release Number
Release Date
July 2021
Content Type
Programming Reference
Publication ID
English (United States)

DateTime expressions always operate within the rules of the Gregorian calendar.

When an evaluation results in a value outside the permissible range for any contained field or results in a value impermissible according to the natural rules for DATE and TIME values, then an error is returned.

For example, the following operation returns an error because it evaluates to a date that is not valid (‘1996-09-31’).

SELECT DATE '1996-08-31' + INTERVAL '1' MONTH;

The desired result is obtained with a slight rephrasing of the second operand.

SELECT DATE '1996-08-31' + INTERVAL '30' DAY;

This operation returns the desired result, ‘1996-09-30’. No error is returned.