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

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


Here how you can get time only from DateTime field:


SELECT DATEADD(day, 0, -DATEDIFF(day, 0, GETDATE()))

 


Posted on Thursday, January 3, 2008 by | Comments (1) | Add Comment

Comments

Gravatar

VeryGOOD

VERY GOOD

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

New Comment

Your Name:
Email (for internal use only):
Comment:
 
Code above:

Categories

Recent Tweets

  • Simon Ince's Blog: Hierarchies with HierarchyID in SQL 2008 http://t.co/xSDwiF6rRS.
  • Visual Studio 2010 WAS painfully slow - CodeProject http://t.co/Usba1x6CZy

Valid HTML5