Export (0) Print
Expand All

DateTime::DayOfYear Property

Gets the day of the year represented by this instance.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public:
property int DayOfYear {
	int get ();
}

Property Value

Type: System::Int32
The day of the year, expressed as a value between 1 and 366.

The DayOfYear property takes leap years into account when it calculates the day of the year. The property value always reflects the day of the year in the Gregorian calendar, regardless of the current thread culture's current calendar. To retrieve the day of the year in a different calendar, call the Calendar::GetDayOfYear method of that calendar.

The following example displays the day of the year of December 31 for the years 2010-2020 in the Gregorian calendar. Note that the example shows that December 31 is the 366th day of the year in leap years.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

XNA Framework

Supported in: 3.0, 2.0, 1.0

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft