MariaDB: DAY Function
This MariaDB tutorial explains how to use the MariaDB DAY function with syntax and examples.
Description
The MariaDB DAY function returns the day portion of a date value.
Syntax
The syntax for the DAY function in MariaDB is:
DAY( date_value )
Parameters or Arguments
- date_value
- A date or datetime value from which to extract the day.
Note
- The DAY function returns the day of the month (a number from 1 to 31) given a date value.
- The DAY function is a synonym for the DAYOFMONTH function.
- See also the EXTRACT, YEAR, QUARTER, MONTH, WEEK, HOUR, MINUTE, SECOND, and MICROSECOND functions.
Applies To
The DAY function can be used in the following versions of MariaDB:
- MariaDB 10
Example
Let's look at some MariaDB DAY function examples and explore how to use the DAY function in MariaDB.
For example:
SELECT DAY('2014-05-19'); Result: 19 SELECT DAY('2014-05-19 08:48:05'); Result: 19 SELECT DAY('2013-12-01'); Result: 1
This last DAY example would display the day portion of the current system date (current system date is returned by the CURDATE function).
SELECT DAY(CURDATE());
Advertisements