Paul Gu | Blog

sharing is caring

Date only in SQL

In many case, you might want to get the date only out of table with time, here is the simple way to achieve it:

 

DATEADD(dd, 0, DATEDIFF(dd, 0, <DateColumn>)) = ‘2011-01-07’

or

DATEADD(dd, 0, DATEDIFF(dd, 0, GetDate())) = ‘2011-01-07’

Next Post

Previous Post

Leave a Reply

© 2024 Paul Gu | Blog

Theme by Anders Norén