DAYOFYEAR()

Documentation

VoltDB Home » Documentation » Using VoltDB

DAYOFYEAR()

DAYOFYEAR() — Returns the day of the year as an integer between 1 and 366.

Synopsis

DAYOFYEAR( timestamp-value )

Description

The DAYOFYEAR() function returns an integer value between 1 and 366 representing the day of the year of a timestamp value. This function produces the same result as using the DAY_OF_YEAR keyword with the EXTRACT() function.

Examples

The following example uses the DAYOFYEAR() function to determine the number of days until an event occurs.

SELECT DECODE(YEAR(NOW), YEAR(starttime), 
     CAST(DAYOFYEAR(starttime) - DAYOFYEAR(NOW) AS VARCHAR) 
           || ' days remaining', 
     CAST(YEAR(starttime) - YEAR(NOW) AS VARCHAR)
           || ' years remaining'),
  eventname FROM event;