MySQL DATE Function

MySQL DATE() function is used to get the date part of a date/time expression.

MySQL DATE() Function Syntax

DATE(date-expression)

MySQL DATE() Function Example

SELECT DATE(NOW())

The result will be: (suppose it’s 2011-11-29 now)
2011-10-29

SELECT DATE('2011-10-10 23:45:33')

The result will be:
2011-10-10

SELECT DATE(DATE_ADD('2011-10-10 23:45:33',INTERVAL 45 DAY))

The result will be:
2011-11-24

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>