How to select only date from a DATETIME field in MySQL?

前端 未结 16 2139
隐瞒了意图╮
隐瞒了意图╮ 2020-11-28 04:37

I have a table in the MySQL database that is set up with DATETIME. I need to SELECT in this table only by DATE and excluding the time.

How d

16条回答
  •  我在风中等你
    2020-11-28 05:08

    Yo can try this:

    SELECT CURDATE();
    

    If you check the following:

    SELECT NOW(); SELECT DATE(NOW()); SELECT DATE_FORMAT(NOW(),'%Y-%m-%d');
    

    You can see that it takes a long time.

提交回复
热议问题