Wednesday, August 28, 2013

Strip Time From Date and Last Moment in SQL

Pretty simple SQL statement that strips the time off of a date and gets the last moment of today.

SELECT 
    DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))
  , DATEADD(ms, -100, DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()) + 1))

No comments: