MySQL DATE () function
Definition and Usage
DATE () function to extract the date part of a date or date / time expression.
grammar
DATE(date)
date date expression argument is legitimate.
Examples
Suppose we have the following "Orders" table:
OrderId | ProductName | OrderDate |
---|---|---|
1 | Jarlsberg Cheese | 2008-11-11 13:23:44.657 |
Here is the SELECT statement:
SELECT ProductName, DATE(OrderDate) AS OrderDate
FROM Orders
WHERE OrderId=1
FROM Orders
WHERE OrderId=1
The results are as follows:
ProductName | OrderDate |
---|---|
Jarlsberg Cheese | 2008-11-11 |
MySQL Date Functions