I want date instead of datetime from my table in sql server?

This question already has an answer here:

  • How to return only the Date from a SQL Server DateTime datatype 37 answers

  • 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

    上一篇: 从基于日期的时间戳查询?

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