Viewing post 1 (of 1 total)
Below is a one line statement to compute last date of the month for a given input date.
DECLARE @MyDate datetime
SET @MyDate = '2012/11/25'
SELECT DATEADD(DAY,DATEPART(DAY,DATEADD(MONTH,1,@MyDate))*-1,DATEADD(MONTH,1,@MyDate))
--Output result: 2012-11-30 00:00:00.000
May 10, 2011 at 3:59 am
Viewing post 1 (of 1 total)
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy