24 April 2014

How to get last day of the month in SQL Server



DECLARE @date DATETIME
SET @date='2014-04-5'
SELECT DATEADD(dd, -DAY(DATEADD(m,1,@date)), DATEADD(m,1,@date)) AS LastDayOfTheMonth

No comments:

Post a Comment