Although this is posted in hundreds of places on the web, for my own sanity as much as anything i'm going to post it here too.
DECLARE @TestDate DATE = '20110417';
SELECT DATEADD(M, DATEDIFF(M, 0, @TestDate), 0) AS NewDate;
-- NewDate
-- 2011-04-01 00:00:00.000
No comments:
Post a Comment