Logo

SQL Server DAYSINYEAR Function

Updated 2023-10-06 23:48:07.103000

Description

Use the scalar function DAYSINYEAR to return the number of days in the year of the specified date.

Syntax

SELECT [westclintech].[wct].[DAYSINYEAR](
   <@StartDate, datetime,>)

Arguments

@StartDate

the specified date. @StartDate is an expression that returns a datetime or smalldatetime value, or a character string in date format.

Return Type

int

Remarks

If @StartDate is NULL then @StartDate = GETDATE().

Examples

SELECT wct.DAYSINYEAR('2014-09-18');

This produces the following result.

column 1
365

See Also

DAYSINMONTH - Number of days in the month of the specified date

NUMMONTHS - Number of months between two dates