I want date instead of datetime from my table in sql server?
This question already has an answer here:
SELECT CAST(enteredDateTime AS DATE)
FROM mytable
Select Convert(Date, EnteredDateTime) as EnteredDateTime
From TableName
看看CAST和CONVERT
Try this:
SELECT CAST(yourDateTimeColumn AS DATE) from tableName
for example
SELECT CAST(GETDATE() AS DATE)
gives me
2014-07-09
Refer this: http://www.w3schools.com/sql/sql_dates.asp
链接地址: http://www.djcxy.com/p/94388.html上一篇: 从基于日期的时间戳查询?