DATE FUNCTION

Extract the date part from a datetime expression. This function returns the year, month, and day portions, discarding the time component.

Syntax

DATE(expr)

Description

Extracts the date part of the date or datetime expression expr. Returns NULL and throws a warning when passed an invalid date.

Examples

SELECT DATE('2013-07-18 12:21:32');
+-----------------------------+
| DATE('2013-07-18 12:21:32') |
+-----------------------------+
| 2013-07-18                  |
+-----------------------------+

This page is licensed: GPLv2, originally from fill_help_tables.sql

Last updated

Was this helpful?