Interface IWeekYearRule
A rule determining how "week years" are arranged, including the weeks within the week year.
Implementations provided by Noda Time itself can be obtained via the
WeekYearRules
class.
Since 3.1.x
Availability net6.0, net8.0, netstandard2.0
Assembly: NodaTime.dll
Syntax
public interface IWeekYearRule
Methods
GetLocalDate(int, int, IsoDayOfWeek, CalendarSystem)
Creates a
LocalDate from a given week-year, week within that week-year,
and day-of-week, for the specified calendar system.
Since 3.1.x
Availability net6.0, net8.0, netstandard2.0
Declaration
LocalDate GetLocalDate(int weekYear, int weekOfWeekYear, IsoDayOfWeek dayOfWeek, CalendarSystem calendar)
Parameters
Type |
Name |
Description |
int |
weekYear |
The week-year of the new date. Implementations provided by Noda Time allow any
year which is a valid calendar year, and sometimes one less than the minimum calendar year
and/or one more than the maximum calendar year, to allow for dates near the start of a calendar
year to fall in the previous week year, and similarly for dates near the end of a calendar year. |
int |
weekOfWeekYear |
The week of week-year of the new date. Valid values for this parameter
may vary depending on weekYear , as the length of a year in weeks varies. |
IsoDayOfWeek |
dayOfWeek |
The day-of-week of the new date. Valid values for this parameter may vary
depending on weekYear and weekOfWeekYear . |
CalendarSystem |
calendar |
The calendar system for the date. |
Returns
Exceptions
GetWeekOfWeekYear(LocalDate)
Calculates the week of the week-year in which the given date occurs, according to this rule.
Since 3.1.x
Availability net6.0, net8.0, netstandard2.0
Declaration
int GetWeekOfWeekYear(LocalDate date)
Parameters
Type |
Name |
Description |
LocalDate |
date |
The date to compute the week of. |
Returns
Type |
Description |
int |
The week of the week-year of date , according to this rule. |
GetWeekYear(LocalDate)
Calculates the week-year in which the given date occurs, according to this rule.
Since 3.1.x
Availability net6.0, net8.0, netstandard2.0
Declaration
int GetWeekYear(LocalDate date)
Parameters
Type |
Name |
Description |
LocalDate |
date |
The date to compute the week-year of. |
Returns
Type |
Description |
int |
The week-year of date , according to this rule. |
GetWeeksInWeekYear(int, CalendarSystem)
Returns the number of weeks in the given week-year, within the specified calendar system.
Since 3.1.x
Availability net6.0, net8.0, netstandard2.0
Declaration
int GetWeeksInWeekYear(int weekYear, CalendarSystem calendar)
Parameters
Type |
Name |
Description |
int |
weekYear |
The week-year to find the range of. |
CalendarSystem |
calendar |
The calendar system the calculation is relative to. |
Returns
Type |
Description |
int |
The number of weeks in the given week-year within the given calendar. |
Extension Methods