Last Day of a Month

Kirthiga
Posted by Kirthiga under Sql Server category on | Points: 40 | Views : 1482
Declare @LastDay datetime='2013-02-25'
select DATEADD(MM,DATEDIFF(MM,0,@LastDay)+1,0)-1 [LastDay Of a Month]

Comments or Responses

Posted by: Pandians on: 5/22/2013 Level:Silver | Status: [Member] [MVP] | Points: 10
Nice!

In another way!
Declare @LastDay datetime='2013-02-25'

SELECT DATEADD(Month,1,@LastDay) - DAY(@LastDay) [LastDay Of a Month]

Login to post response