Function Dates Times Class

DayOfYear

Return the day of the year for a given date. The days are numbered consecutively starting with the first day of the year.

Signature (Visual Basic / VBA)

Public Function DayOfYear( _
    ByVal vDate As Variant _
    ) As Variant

Code Example

    DayOfYear(#01/01/96#) = 1
    DayOfYear(#02/01/96#) = 32
    DayOfYear(#02/29/96#) = 60
    DayOfYear(#03/01/96#) = 61
    DayOfYear(#12/25/96#) = 360

Parameters

Parameter Description
vDate The date whose "day of the year" number is returned. Function returns Null if vDate is Null or cannot be fixed up to a Date.