开发者

How to Convert following date to YYYY-MM-DD

I entered data into a database, but the date is off, it 开发者_运维百科is showing to the seconds.

How can i do a select statement to get this:

2010-02-18 07:45:00

To This:

2010-02-18

I am not the computer guy here....Thanks!


SELECT Convert(varchar(10), DateColumn, 120) FROM TABLE


For any SQL Server version

select dateadd(d, datediff(d, 0, datecolumn), 0), ..
from ..

or for your 2008

select CAST(datecolumn as Date), ....
from ..


DATE('2010-02-18 07:45:00');  

or variable in there

Or just change the column type definition from datetime to date

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜