I'm trying to write a code that will pick-up the end of the previous month, but I encountered a road block when the month such as February is a leap year. 2011 has 28 days and 2012 has 29 days. Trying to figure out how to incorporate leap year in the code below:
Thanks.
Code:
DateAdd(day, -1, DateAdd(month, DateDiff(month, 0, GETDATE())+1, 0))
Comment