How to select date without time in SQL

后端 未结 17 2099
灰色年华
灰色年华 2020-11-28 20:09

When I select date in SQL it is returned as 2011-02-25 21:17:33.933. But I need only the Date part, that is 2011-02-25. How can I do this?

17条回答
  •  南方客
    南方客 (楼主)
    2020-11-28 20:54

    In case if you need the time to be zeros like 2018-01-17 00:00:00.000:

    SELECT CONVERT(DATETIME, CONVERT(DATE, GETDATE()), 121)

提交回复
热议问题