Archives of the TeradataForum
Message Posted: Wed, 14 May 2003 @ 16:23:58 GMT
Subj: | | Re: Date Arithmetic |
|
From: | | Geoffrey Rommel |
| Was wondering if there is a way to also calculate number of months and years between dates. | |
/* This is an interval. */
sel current_date - date '2001-01-02' year to month;
(Date - 2001-01-02) YEAR TO MONTH
---------------------------------
2-04
Because not all months are the same length, interval types cannot span months -- i.e., you can have a year-to-month interval, but not a
year-to-day interval.
I have attached a document that should answer other questions of this kind. If John sees fit, he can post it on the Forum Web site.
(See attached file: howto_times2.htm)
Admin Comment: This document can be found at:
www.teradataforum.com/l030515a.htm
|