MySQL DATE_FORMAT() Function
Definition and Usage
The DATE_FORMAT() function formats a date as specified.
Syntax
DATE_FORMAT(date, format)
Parameter Values
| Parameter | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| date | Required. The date to be formatted | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| format | Required. The format to use. Can be one or a
combination of the following values:
|
Technical Details
| Works in: | From MySQL 4.0 |
|---|
More Examples
Example
Format a date:
SELECT DATE_FORMAT(BirthDate, "%W %M %e %Y") FROM Employees;
Try it Yourself »