Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
DECLARE @time DATETIME = DATEFROMPARTS(2014, 11, 15);
-- Using 998 for milliseconds portion because using 999 winds up being the same as 000 of the next second, for some weird reason.
-- This winds up being 2014-11-15 23:59:59.997, even though we've specified 998.
SELECT DATETIMEFROMPARTS(DATEPART(year, @endTime), DATEPART(month, @endTime), DATEPART(day, @endTime), 23, 59, 59, 998);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment