Trunc date field in mysql like Oracle

前端 未结 2 866
滥情空心
滥情空心 2020-12-20 11:27

I am to not able to use the \'trunc(in oracle)\' function in \'mysql\' database. I have a table called dlb_cc_purchase and date field called due_date in my \'mysql\' datab

相关标签:
2条回答
  • 2020-12-20 11:47

    Use DATE(expr) function. Query example:

    SELECT *
      FROM dlbcc_purchase
      WHERE DATE(due_date) = '2014-11-20'
    
    0 讨论(0)
  • 2020-12-20 11:56

    You can use DATE_FORMAT().

    example:

    select * from dlbcc_purchase where DATE_FORMAT(due_date,'%d-%b-%Y') = '20-nov-2014' 
    
    0 讨论(0)
提交回复
热议问题