Home Page for the TeradataForum

Archives of the TeradataForum

Message Posted: Wed, 14 May 2003 @ 16:12:58 GMT

  <Prev Next>   <<First <Prev Next> Last>>  

Subj:   Re: Date Arithmetic
From:   Dieter Nöth

somya.chaudhary wrote:

  Was wondering if there is a way to also calculate number of months and years between dates. The only answer we get using, e.g. (current_date - install_dt) is in number of days. Other systems usually have an option of whether the result should be in days, months or years.  

As substracting two dates results in an INTERVAL you just have to specify it's kind (V2R3+):

   (current_date - install_dt) year,
   (current_date - install_dt) month,
   (current_date - install_dt) year to month

But beware of the default precision of 2 and the maximum of 4, so maximum number of month is 9999.

For details look at the SQL manuals...


  <Prev Next>   <<First <Prev Next> Last>>  
  Top Home Privacy Feedback  
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 27 Dec 2016