Skip to content

DAYOFYEAR

  • date: This parameter represents the date value from which the day of the year will be extracted. The date must be a valid one in the format ‘YYYY-MM-DD’ or ‘YYYYMMDD’. This function will return null if the input date is invalid.
SELECT DAYOFYEAR('2022-05-22') AS 'Day of Year';
142

The DAYOFYEAR function in this example returns the day of the year from the date ‘2022-05-22’. The output is ‘142’, meaning ‘2022-05-22’ is the 142nd day of the year 2022.