MariaDB: DATE Function
This MariaDB tutorial explains how to use the MariaDB DATE function with syntax and examples.
Description
The MariaDB DATE function extracts the date value from a date or datetime expression.
Syntax
The syntax for the DATE function in MariaDB is:
DATE( expression )
Parameters or Arguments
- expression
- The date or datetime value from which the date should be extracted.
Note
- If expression is not a date or a datetime value, the DATE function will return NULL.
- See also the CAST function.
Applies To
The DATE function can be used in the following versions of MariaDB:
- MariaDB 10
Example
Let's look at some MariaDB DATE function examples and explore how to use the DATE function in MariaDB.
For example:
SELECT DATE('2014-05-18'); Result: '2014-05-18' SELECT DATE('2014-05-18 11:13:19'); Result: '2014-05-18' SELECT DATE('2014-05-18 11:13:01.000001'); Result: '2014-05-18' SELECT DATE('The date is 2014-05-18'); Result: NULL SELECT DATE(NULL); Result: NULL
Advertisements