我希望日期而不是我的表中的日期时间在sql服务器?

这个问题在这里已经有了答案:

  • 如何仅返回来自SQL Server DateTime数据类型的日期37个答案

  • SELECT  CAST(enteredDateTime AS DATE)
    FROM    mytable
    

    Select Convert(Date, EnteredDateTime) as EnteredDateTime
    From TableName
    

    看看CAST和CONVERT


    尝试这个:

    SELECT  CAST(yourDateTimeColumn AS DATE) from tableName
    

    例如

    SELECT  CAST(GETDATE() AS DATE)
    

    给我

    2014-07-09
    

    请参阅:http://www.w3schools.com/sql/sql_dates.asp

    链接地址: http://www.djcxy.com/p/94387.html

    上一篇: I want date instead of datetime from my table in sql server?

    下一篇: How to get first hour of today in SQL Server?