ISOWeek.GetYear Method

Definition

Overloads

GetYear(DateOnly)
GetYear(DateTime)

Calculates the ISO week-numbering year (also called ISO year informally) mapped to the input Gregorian date.

GetYear(DateOnly)

C#
public static int GetYear(DateOnly date);

Parameters

date
DateOnly

Returns

Applies to

.NET 10
Product Versions
.NET 10

GetYear(DateTime)

Source:
ISOWeek.cs
Source:
ISOWeek.cs
Source:
ISOWeek.cs

Calculates the ISO week-numbering year (also called ISO year informally) mapped to the input Gregorian date.

C#
public static int GetYear(DateTime date);

Parameters

date
DateTime

A date in the Gregorian calendar.

Returns

The ISO week-numbering year, between 1 and 9999

Remarks

The ISO week-numbering year number mapping to Gregorian date can be different than the year of the given Gregorian. or example, the Gregorian date 2005-01-01 maps to the ISO week-numbering year 2004.

Applies to

.NET 10 and other versions
Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9, 10
.NET Standard 2.1