DateTime::Year Property

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

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

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

Property Value

Type: System::Int32
The year component, expressed as a value between 1 and 9999.

The Year 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. The following example, which assumes that the target computer's current culture is th-TH, illustrates this.

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.

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show: