Thursday, October 11, 2007

T-SQL: Get only Date from DateTime

I finally found a solution for a problem I often have... How to get only the datepart from a DateTime in T-SQL? Since I like this kind of tricks in T-SQL I just thought to post kinda the same just make it more simple.

SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))

0 comments: