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');
Example 1: MySQL DAYOFYEAR() Function

MySQL DAYOFYEAR() Function Example 2

SELECT DAYOFYEAR('2011-10-18');
Example 2: MySQL DAYOFYEAR() Function

MySQL DAYOFYEAR() Function Example 3

SELECT DAYOFYEAR('2011-10-34');
Example 3: MySQL DAYOFYEAR() Function

If the date is not valid then in such case it will return you the NULL.




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.