sathish

sathish

  • NA
  • 263
  • 0

Leap year increment

Sep 20 2019 4:20 AM
Hi,
 
   I have a logic to increment the year by 1 ..so the below one I used in sql
 
   @date='2019-01-31' 
   select dateadd(year,1,@date')  
 
  It gives me result as '2020-01-31'
 
  @date='2019-02-28'  
 
  But for Feb since 2020 leap year  if I do the same its gives result as '2020-02-28' instead should
  give '2020-02-29'
 
  Kindly let me know the query to verify and get this one.
 
Thanks
Sathish 
 

Answers (2)