DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Get The First And Last Day Of The Previous Month T-SQL
// Get the first and last day of the previous month T-SQL
declare @date datetime set @date = dateadd(m,-1,getdate()) --get first day of month select dateadd(m, datediff(m, 0, @date), 0) --get last day of month select dateadd(m, datediff(m, 0, dateadd(m, 1, @date)), -1)





