sql - Set time part of datetime variable to 18:00 -


I need to set datetime variable in two days from now but it should be part of the time 18:00.

For example, if I call getdate () then I'll get 2010-05-17 13: 18: 07.260 . I need to set it to 2010-05-19 18: 00: 00.000 .

Does anyone have a good snippet or how to correct any of its ideas?

  select DATEADD (hh, 24 * 2 + 18, DATEADD (dd, DATEDIFF) (Dd, 0), date ()), 0))  

This shortens the current date and it will be (24 * 2 + 18) for 2 days and 18 hours ) .

A possible difference:

  select dateADD (hh, 18, DATEADD (DD, DATEDIFF (dd, -2, GETDATE ()), 0))  

Comments