DAYOFYEAR Function

Description

The DAYOFYEAR function returns the day of a year in the range of 1 to 366. You can specify the DATE, TIMESTAMP, or DATETIME types; the value is returned in INTEGER type.

If every argument value of date and time is 0, the return value is determined by the return_null_on_function_errors system parameter; if it is set to yes, then NULL is returned; if it is set to no, an error is returned. The default value is no.

Syntax

DAYOFYEAR(date)

Example

SELECT DAYOFYEAR('2010-09-09');

   dayofyear('2010-09-09')

==========================

                       252

 

SELECT DAYOFYEAR('2010-09-09 19:49:29');

dayofyear('2010-09-09 19:49:29')

=================================

                            252

 

SELECT DAYOFYEAR('10:28:00');

ERROR: Conversion error in date format.

 

SELECT DAYOFYEAR('0000-00-00');

ERROR: Conversion error in date format.