Coding Horror posted by:
Manicse | Posted on: 7/9/2012 | Category:
SQL Server | Views: 2078 | Level:
Starter | Status:
[Member] |
Points: 75
|
Alert Moderator
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
Found interesting? Add this to: