Wednesday, 4 January 2012

MySQL date

MySQL DATE() takes the date part out from a datetime expression.

This is an important function of date and time function in Mysql.


Syntax

DATE(expr);

Where expr is a datetime.


 

Example

SELECT DATE('2008-05-17 11:31:31') as required_date;

 

Explanation

The statement describe above will filter the date portion from the mentioned datetime 2008-05-17 11:31:31.

 

Output

MySQL DATE()

No comments:

Post a Comment