DateTime.Year Property

 

Gets the year component of the date represented by this instance.

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

member Year : int with get

Property Value

Type: System.Int32

The year, between 1 and 9999.

TheYear property returns the year of the current instance in the Gregorian calendar. It does not return the year using the default calendar of the current culture. To retrieve the year using a particular calendar, you can call that calendar's GetYear method, as the following code shows.

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

The following example demonstrates the Year property.

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

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: