Home »
MySQL »
MySQL date/time Functions
MySQL DAYOFYEAR() Function
MySQL | DAYOFYEAR() Function: Learn about the DAYOFYEAR() function, how it works, its usages, syntax, and examples.
Submitted by Apurva Mathur, on October 05, 2022
DAYOFYEAR() Function
The DAYOFYEAR() function returns you the day of the year of the specified date.
DAYOFYEAR() Syntax
SELECT DAYOFYEAR('date');
DAYOFYEAR() Parameter(s)
- date: It accepts a date for which you have to get the day of the year (1-366).
DAYOFYEAR() Return Value
As a result, it will return you the day of the year from the date you have provided.
MySQL DAYOFYEAR() Function Example 1
SELECT DAYOFYEAR('2022-10-11');
MySQL DAYOFYEAR() Function Example 2
SELECT DAYOFYEAR('2011-10-18');
MySQL DAYOFYEAR() Function Example 3
SELECT DAYOFYEAR('2011-10-34');
If the date is not valid then in such case it will return you the NULL.