Pages

Wednesday, June 29, 2011

How to grab dates using built in system functions.

Select [DATE] = DATEADD(m,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0))
- First Day of the month with time of 00:00:00

Select [DATE] = DATEADD(s,-1,DATEADD(mm, DATEDIFF(m,0,GETDATE())+1,0))
- Last Day of the month