Example: Calculating the Difference in Days between DATE Values - Teradata VantageCloud Lake

Lake - Working with SQL

Deployment
VantageCloud
Edition
Lake
Product
Teradata VantageCloud Lake
Release Number
Published
February 2025
ft:locale
en-US
ft:lastEdition
2025-11-21
dita:mapPath
jbe1714339405530.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
jbe1714339405530

The following query calculates the difference in days between the two DATE values.

SELECT (DATE '2007-05-10' - DATE '2007-04-28') DAY;

The result is the following:

(2007-05-10 - 2007-04-28) DAY
-----------------------------
12

The following query calculates the difference in months between the two DATE values.

SELECT (DATE '2007-05-10' - DATE '2007-04-28') MONTH;

The result is the following:

(2007-05-10 - 2007-04-28) MONTH
-------------------------------
1

There is a difference of 12 days between the two dates, which does not constitute one month. However, Vantage ignores the day values during the calculation and only considers the month values, so the result is an interval of one month indicating the difference between April and May.