DATE and Date Arithmetic - Advanced SQL Engine - Teradata Database

SQL Date and Time Functions and Expressions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
xmd1556127764262.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1211
lifecycle
previous
Product Category
Teradata Vantageā„¢

The DATE - DATE expression is not processed as a simple subtraction, but rather as explained in the following process:

  1. The encoded date values are converted to intermediate values which are each the number of days since a system-defined fixed date.
  2. The second of these values is then subtracted from the first, giving the number of days between the two dates.
  3. The result is returned as if it were in the ANSI SQL:2011 form INTERVAL DAY, though the value itself is an integer.

Other arithmetic operations on date values may provide results, but those results are not meaningful.