DAYOFYEAR() function in MySQL

DAYOFYEAR() function The MySQL DAYOFYEAR function is used to get the day of the year value for a date or datetime value. The various versions of MySQL support the DAYOFYEAR function, namely, MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0 and MySQL 3.23.

Syntax:

DAYOFYEAR( expression )

Parameters:

expression: It is used to specify the date or datetime value.

Example 1:

mysql> SELECT DAYOFYEAR ('2019-12-31');

Output:

365

Explanation:

The day of the year value has been returned for the date value.

Example 2:

mysql> SELECT DAYOFYEAR ('2019-01-01');

Output:

1

Explanation:

The day of the year value has been returned for the date value.

Please follow and like us:
Content Protection by DMCA.com