Wednesday, March 7, 2012

Date Format Conversion

New to SQL and have a hopefully simple ?
I have a select statement that returns a date field in the yyyy-mm-dd
hh:mm:ss format. I would like to find a way to strip off the hh:mm:ss
portion and return the date only.
Thanks for the assistSee CONVERT() in Books Online:

select CONVERT(char(10), getdate(), 120)

You might also find this article useful for reference:

http://www.karaszi.com/sqlserver/info_datetime.asp

Simon|||You can use a proprietary CONVERT() function, or you can do the display
formatting in the front end like you are supposed to in a tiered
architecture.|||Thanks Simon/--Celko--

No comments:

Post a Comment