Get first & last day of current month.

Return two column, the first and last day of the current month.

Last updated:

Warning: Review and test in a non-production environment before running.

Back to results

SELECT    DATEADD(MONTH, DATEDIFF(MONTH, '19000201', GETDATE()), '19000101') AS FirstPreviousMonth,
                 DATEADD(MONTH, DATEDIFF(MONTH, '19000101', GETDATE()), '18991231') AS LastPreviousMonth

select dateadd(d,-1,dateadd(mm,datediff(m,0,getdate()),1 ))
select dateadd(s,-1,dateadd(mm,datediff(m,0,getdate())+1,0))