简体   繁体   中英

How to convert a string to Date format

I have the following sql statement line:

CAST(convert(varchar(10), CT.ATTR2752, 110) as datetime) 'New'

which displays:

2014-12-19 00:00:00.000

I am trying to convert it to 12-19-2014 and use it as DATE instead of a string.

How can I accomplish that?

I know I have to use CAST and CONVERT together but not sure how.

CAST(convert(varchar(10), CT.ATTR2752, 110) as date) 'New'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM