0

Is it possible to edit the values of some rows in the results?

Specifically I want to be able to round off dates to the nearest hour inside the results themselves.

Andrei Sevtsenko
  • 213
  • 4
  • 15
  • 1
    Usually any operations you can do within the database are available also when returning the data. – Sami Kuhmonen Jul 18 '16 at 09:02
  • I'm on Microsoft SQL. How would I use round() on a time? All the info I can find uses numbers as a param. – Andrei Sevtsenko Jul 18 '16 at 09:32
  • Possible duplicate of [T-SQL datetime rounded to nearest minute and nearest hours with using functions](http://stackoverflow.com/questions/6666866/t-sql-datetime-rounded-to-nearest-minute-and-nearest-hours-with-using-functions) – AHiggins Jul 18 '16 at 19:31

1 Answers1

1

I ended up doing:

SELECT DATEADD(minute, DATEDIFF(minute,0,DATETIME) / 30 * 30 ,0) AS "Rounded Time"
Andrei Sevtsenko
  • 213
  • 4
  • 15