Trunc date field in mysql like Oracle

Trunc date field in mysql like Oracle

Use DATE(expr) function. Query example:

SELECT *
  FROM dlbcc_purchase
  WHERE DATE(due_date) = 2014-11-20

You can use DATE_FORMAT().

example:

select * from dlbcc_purchase where DATE_FORMAT(due_date,%d-%b-%Y) = 20-nov-2014 

Trunc date field in mysql like Oracle

Leave a Reply

Your email address will not be published.