Udostępnij za pośrednictwem


WeekFields.WeekBasedYear Method

Definition

Returns a field to access the year of a week-based-year based on this WeekFields.

[Android.Runtime.Register("weekBasedYear", "()Ljava/time/temporal/TemporalField;", "", ApiSince=26)]
public Java.Time.Temporal.ITemporalField? WeekBasedYear ();
[<Android.Runtime.Register("weekBasedYear", "()Ljava/time/temporal/TemporalField;", "", ApiSince=26)>]
member this.WeekBasedYear : unit -> Java.Time.Temporal.ITemporalField

Returns

a field providing access to the week-based-year, not null

Attributes

Remarks

Returns a field to access the year of a week-based-year based on this WeekFields.

This represents the concept of the year where weeks start on a fixed day-of-week, such as Monday and each week belongs to exactly one year. This field is typically used with WeekFields#dayOfWeek() and WeekFields#weekOfWeekBasedYear().

Week one(1) is the week starting on the WeekFields#getFirstDayOfWeek where there are at least WeekFields#getMinimalDaysInFirstWeek() days in the year. Thus, week one may start before the start of the year. If the first week starts after the start of the year then the period before is in the last week of the previous year.

This field can be used with any calendar system.

In the resolving phase of parsing, a date can be created from a week-based-year, week-of-year and day-of-week.

In ResolverStyle#STRICT strict mode, all three fields are validated against their range of valid values. The week-of-year field is validated to ensure that the resulting week-based-year is the week-based-year requested.

In ResolverStyle#SMART smart mode, all three fields are validated against their range of valid values. The week-of-week-based-year field is validated from 1 to 53, meaning that the resulting date can be in the following week-based-year to that specified.

In ResolverStyle#LENIENT lenient mode, the year and day-of-week are validated against the range of valid values. The resulting date is calculated equivalent to the following three stage approach. First, create a date on the first day of the first week in the requested week-based-year. Then take the week-of-week-based-year, subtract one, and add the amount in weeks to the date. Finally, adjust to the correct day-of-week within the localized week.

Java documentation for java.time.temporal.WeekFields.weekBasedYear().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to