MariaDB: DAYOFMONTH Function
This MariaDB tutorial explains how to use the MariaDB DAYOFMONTH function with syntax and examples.
Description
The MariaDB DAYOFMONTH function returns the day portion of a date value.
Syntax
The syntax for the DAYOFMONTH function in MariaDB is:
DAYOFMONTH( date_value )
Parameters or Arguments
- date_value
- A date or datetime value from which to extract the day of the month.
Note
- The DAYOFMONTH 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.
Applies To
The DAYOFMONTH function can be used in the following versions of MariaDB:
- MariaDB 10
Example
Let's look at some MariaDB DAYOFMONTH function examples and explore how to use the DAYOFMONTH function in MariaDB.
For example:
SELECT DAYOFMONTH('2014-05-19'); Result: 19 SELECT DAYOFMONTH('2014-05-19 08:51:05'); Result: 19 SELECT DAYOFMONTH('2013-11-03'); Result: 3
This last DAYOFMONTH example would display the day portion of the current system date (current system date is returned by the CURDATE function).
SELECT DAYOFMONTH(CURDATE());
Advertisements