Skip to content

Instantly share code, notes, and snippets.

@bitsprint
Created September 17, 2013 09:26
Show Gist options
  • Select an option

  • Save bitsprint/6592067 to your computer and use it in GitHub Desktop.

Select an option

Save bitsprint/6592067 to your computer and use it in GitHub Desktop.
Round date to midnight
-- SQL 2008
DECLARE @CurrentDate DATETIME = (cast(GETDATE() as date))
-- Pre SQL 2008
DECLARE @CurrentDate DATETIME = DateAdd(Day, Datediff(Day, 0, GetDate()), 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment