DATEADD FUnction
Posted by
Manicse under
Sql Server on 7/9/2012 8:48:57 AM |
Points: 75 | Views : 5526 | Status :
[Member]
Recently i have got a error in my application.
My application is based on banking. While payment happened in every month we need to move the next payment date to the next month.
Consider a scenario,
Payment Date is : 20th Aug
So if he pays for August then the Next payment date will be 20th Sep using the function in sql.
Now if a user is paying for the month of January, his current next date is
Payment Date: 30th Jan
Now we are adding the DateADD function.
DATEADD(M,1,'01/30/2012') -----> Output will be 29th FEB(for Leap Year) and 28th FEB(Non Leap Years)
So all the dates will be wrong with the further Dateadd() function.
Mani.R