Friday 16 April 2010

Get Date from DateTime in MS SQL

I needed to convert DATETIME to just DATE in standard format.
Simplest solution that I found out is:

CONVERT(DATE, GETDATE())

where DATE is format and GETDATE() is just a value in DATETIME format.

For example, 2010-04-16 09:44:41.323 will become 2010-04-16 after such conversion.

No comments: