Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 31 Dec 2003 @ 17:09:32 GMT


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


Subj:   Re: ADD_MONTHS
 
From:   Dieter Noeth

Swarnapuri, Vinod wrote:

  I expected ADD_MONTHS(DATE '2003-11-30', -1) function to return '2003-10-31', but it returns '2003-10-30'. Is it a bug?  


No, just think about which date you'd expect for ADD_MONTHS(DATE '2003-11-29', -1), '2003-10-30'?

If you want to calculate the last day of the previous month:

DATE '2003-11-30' - EXTRACT(DAY FROM DATE '2003-11-30');


Dieter



     
  <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: 15 Jun 2023