Skip to content

Instantly share code, notes, and snippets.

@jsauve
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsauve/19c084612ac0466921a0 to your computer and use it in GitHub Desktop.
Save jsauve/19c084612ac0466921a0 to your computer and use it in GitHub Desktop.
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