Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Globalization.​ISOWeek
Assembly: System.Runtime
Inheritance: object → ISOWeek
Provides static members to support the ISO week date that is part of the ISO 8601 date and time standard issued by the International Organization for Standardization (ISO).
Methods
public static
int
GetWeekOfYear​(DateOnly date)
Calculates the ISO week number of a given Gregorian date.
Returns A number between 1 and 53 representing the ISO week number of the given Gregorian date.
date
A date in the Gregorian calendar.
public static
int
GetWeekOfYear​(DateTime date)
Calculates the ISO week number of a given Gregorian date.
Returns A number between 1 and 53 representing the ISO week number of the given Gregorian date.
date
A date in the Gregorian calendar.
public static
int
GetWeeksInYear​(int year)
calculates the number of weeks in a given ISO week-numbering year.
Returns The number of ISO weeks in the year. Returns either 52 or 53.
year
An ISO week-numbering year (also called an ISO year informally).
public static
int
GetYear​(DateOnly date)
Calculates the ISO week-numbering year (also called ISO year informally) mapped to the input Gregorian date.
Returns The ISO week-numbering year, between 1 and 9999
date
A date in the Gregorian calendar.
public static
int
GetYear​(DateTime date)
Calculates the ISO week-numbering year (also called ISO year informally) mapped to the input Gregorian date.
Returns The ISO week-numbering year, between 1 and 9999
date
A date in the Gregorian calendar.
public static
DateTime
GetYearEnd​(int year)
Calculates the Gregorian date at which the week-numbering year will end.
Returns The Gregorian date at which the week-numbering year will end.
year
An ISO week-numbering year (also called an ISO year informally).
public static
DateTime
GetYearStart​(int year)
Calculates the Gregorian date at which the week-numbering year will start.
Returns The Gregorian date at which the week-numbering year will start.
year
An ISO week-numbering year (also called an ISO year informally).
public static
DateOnly
ToDateOnly​(int year,
int week,
DayOfWeek dayOfWeek)
Maps the ISO week date represented by a specified ISO year, week number, and day of week to the equivalent Gregorian date.
Returns The Gregorian date equivalent to the input ISO week date.
year
An ISO week-numbering year (also called an ISO year informally).
week
The ISO week number in the given ISO week-numbering year.
dayOfWeek
The day of week inside the given ISO week.
public static
DateTime
ToDateTime​(int year,
int week,
DayOfWeek dayOfWeek)
Maps the ISO week date represented by a specified ISO year, week number, and day of week to the equivalent Gregorian date.
Returns The Gregorian date equivalent to the input ISO week date.
year
An ISO week-numbering year (also called an ISO year informally).
week
The ISO week number in the given ISO week-numbering year.
dayOfWeek
The day of week inside the given ISO week.
public
bool
Equals​(object obj)
Inherited from object
Determines whether the specified object is equal to the current object.
Returns <see langword="true" /> if the specified object is equal to the current object; otherwise, <see langword="false" /> .
obj
The object to compare with the current object.
protected
void
Finalize​()
Inherited from object
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
public
int
GetHashCode​()
Inherited from object
Serves as the default hash function.
Returns A hash code for the current object.
public
Type
GetType​()
Inherited from object
Gets the <see cref="T:System.Type" /> of the current instance.
Returns The exact runtime type of the current instance.
protected
object
MemberwiseClone​()
Inherited from object
Creates a shallow copy of the current <see cref="T:System.Object" /> .
Returns A shallow copy of the current <see cref="T:System.Object" /> .
public
string
ToString​()
Inherited from object
Returns a string that represents the current object.
Returns A string that represents the current object.