Wednesday, March 7, 2012

How to get only date component from a datetime column

Hi all,

I have a table containing a datetime column and it stores date with time ( I use GETDATE() to store the value ). For reporting purpose I need only the date component from this column without the time component. I do not want to use the datepart(yyyy, orderdt), datepart(mm, orderdt) and datepart(dd, orderdt).

Will following help

select CONVERT ( VARCHAR (10) , GetDATE(), 121 )

No comments:

Post a Comment