Curriculum
Course: MYSQL
Login

Curriculum

MYSQL

MySQL References

0/140
Text lesson

DAYOFYEAR

Example

Retrieve the day of the year from a given date.

SELECT DAYOFYEAR(“2017-06-15”);

Definition and Usage

The DAYOFYEAR() function retrieves the day of the year for a specified date, represented as a number ranging from 1 to 366.

Syntax

DAYOFYEAR(date)

Parameter Values

Parameter

Description

date

Necessary. Specify the date from which to retrieve the day of the year.

Technical Details

Works in:

 From MySQL version 4.0

More Examples

Example

Determine the day of the year for a given date.

SELECT DAYOFYEAR(“2017-01-01”);

Example

Retrieve the day of the year for today’s date.

SELECT DAYOFYEAR(CURDATE());