Skip to content

Instantly share code, notes, and snippets.

@radleta
Created December 24, 2013 13:25
Show Gist options
  • Save radleta/8113319 to your computer and use it in GitHub Desktop.
Save radleta/8113319 to your computer and use it in GitHub Desktop.
Round DateTime to nearest hour. Useful when grouping by DateTime to round to the nearest hour.
SELECT dateadd(hour, datediff(hour, 0, GETDATE()), 0) NearestHour
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment