MariaDB: DAYOFYEAR Function
This MariaDB tutorial explains how to use the MariaDB DAYOFYEAR function with syntax and examples.
Description
The MariaDB DAYOFYEAR function returns day of the year for a date value.
Syntax
The syntax for the DAYOFYEAR function in MariaDB is:
DAYOFYEAR( date_value )
Parameters or Arguments
- date_value
- A date or datetime value from which to extract the day of the year.
Note
- The DAYOFYEAR function returns the day of the year (a number from 1 to 366) given a date value.
Applies To
The DAYOFYEAR function can be used in the following versions of MariaDB:
- MariaDB 10
Example
Let's look at some MariaDB DAYOFYEAR function examples and explore how to use the DAYOFYEAR function in MariaDB.
For example:
SELECT DAYOFYEAR('2014-01-01'); Result: 1 SELECT DAYOFYEAR('2014-05-19'); Result: 139 SELECT DAYOFYEAR('2014-12-31'); Result: 365 SELECT DAYOFYEAR('2016-12-31'); Result: 366
This last DAYOFYEAR example would display the day of the year for the current system date (current system date is returned by the CURDATE function).
SELECT DAYOFYEAR(CURDATE());
Advertisements