Query to find Last day of the current month

Posted by Kirthiga under Sql Server on 5/23/2018 | Points: 10 | Views : 3074 | Status : [Member] | Replies : 1
How to find last day of the current month in sql server




Responses

Posted by: Rajnilari2015 on: 5/23/2018 [Member] [Microsoft_MVP] [MVP] Platinum | Points: 25

Up
0
Down
Try this

select 
EOMONTH(getdate()), -- sql server 2012 onwards
DATEADD(d, -1, DATEADD(m, DATEDIFF(m, 0, getdate()) + 1, 0)) -- any version of sql


Hope this helps

--
Thanks & Regards,
RNA Team

Kirthiga, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response