DATE and Date Arithmetic - Analytics Database - Teradata Vantage

SQL Date and Time Functions and Expressions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-10-30
dita:mapPath
cpk1628111786971.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
pxz1544241488545
lifecycle
latest
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.