Following are two ways of adding days and months to a given date. Both seem to be logically correct but returns different values.
Column number 1: Add months and then days, Column number 2: Add days and then months
DECLARE @d DATE = '20140128'
SELECT DATEADD(DAY, 3, DATEADD(MONTH, 1, @d)) Add_Months_Days,
DATEADD(MONTH, 1, DATEADD(DAY, 3, @d)) Add_Days_Months
Add_Months_Days Add_Days_Months
---------------- ----------------
2014-03-03 2014-02-28
I understand why it is happening and both are logical too. But in a situation where we need to add months and days to a given date at the same time, is there a standard way to do this?