开发者

How to Convert following date to YYYY-MM-DD

开发者 https://www.devze.com 2023-02-13 06:52 出处:网络
I entered data into a database, but the date is off, it 开发者_运维百科is showing to the seconds.

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

精彩评论

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