How to get just the date part of getdate()?

This question already has an answer here:

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

  • If you are using SQL Server 2008 or later

    select convert(date, getdate())
    

    Otherwise

    select convert(varchar(10), getdate(),120)
    

    try this:

    select convert (date ,getdate())
    

    or

    select CAST (getdate() as DATE)
    

    or

    select convert(varchar(10), getdate(),121)
    

    尝试这个:

    SELECT CONVERT(date, GETDATE())
    
    链接地址: http://www.djcxy.com/p/94372.html

    上一篇: 如何从SQL中的DATETIME列中获取DATE?

    下一篇: 如何获取getdate()的日期部分?