Open In App

DAYOFYEAR() Function in MySQL

Improve
Improve
Like Article
Like
Save
Share
Report

DAYOFYEAR() function: This function in MySQL is used to return the day of the year for a specified date (a number from 1 to 366).

Syntax :

DAYOFYEAR(date)

Parameter :

This method accepts a parameter which is illustrated below:

  • date: Specified date to return the day of the year from

Returns :

It returns the day of the year for a specified date (a number from 1 to 366).

Example-1 :

Getting the day of the year for a specified date “2020-11-24”.

SELECT DAYOFYEAR("2020-06-24");

Output :

176

Example-2 :

Getting the day of the year for a specified date “2020-11-22 07:12:23”.

SELECT DAYOFYEAR("2020-10-22 07:12:23");

Output :

296

Example-3 :

Getting the day of the year for the current system date.

SELECT DAYOFYEAR(CURDATE());

Output :

329

Last Updated : 27 Nov, 2020
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads