KARPACH

WEB DEVELOPER BLOG

T-SQL: How to get only Date from DateTime?

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

Here is how you can get time only from a DateTime field:

SELECT DATEADD(day, 0, -DATEDIFF(day, 0, GETDATE()))
Posted on January 3, 2008 by

Comments

Posted on 6/26/2008 02:47:04 AM by from vitenam

VERY GOOD