WeekFields Class

Definition

Localized definitions of the day-of-week, week-of-month and week-of-year fields.

[Android.Runtime.Register("java/time/temporal/WeekFields", ApiSince=26, DoNotGenerateAcw=true)]
public sealed class WeekFields : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ISerializable
[<Android.Runtime.Register("java/time/temporal/WeekFields", ApiSince=26, DoNotGenerateAcw=true)>]
type WeekFields = class
    inherit Object
    interface ISerializable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
WeekFields
Attributes
Implements

Remarks

Localized definitions of the day-of-week, week-of-month and week-of-year fields.

A standard week is seven days long, but cultures have different definitions for some other aspects of a week. This class represents the definition of the week, for the purpose of providing TemporalField instances.

WeekFields provides five fields, #dayOfWeek(), #weekOfMonth(), #weekOfYear(), #weekOfWeekBasedYear(), and #weekBasedYear() that provide access to the values from any Temporal temporal object.

The computations for day-of-week, week-of-month, and week-of-year are based on the ChronoField#YEAR proleptic-year, ChronoField#MONTH_OF_YEAR month-of-year, ChronoField#DAY_OF_MONTH day-of-month, and ChronoField#DAY_OF_WEEK ISO day-of-week which are based on the ChronoField#EPOCH_DAY epoch-day and the chronology. The values may not be aligned with the ChronoField#YEAR_OF_ERA year-of-Era depending on the Chronology.

A week is defined by: <ul> <li>The first day-of-week. For example, the ISO-8601 standard considers Monday to be the first day-of-week. <li>The minimal number of days in the first week. For example, the ISO-8601 standard counts the first week as needing at least 4 days. </ul> Together these two values allow a year or month to be divided into weeks.

<h2>Week of Month</h2> One field is used: week-of-month. The calculation ensures that weeks never overlap a month boundary. The month is divided into periods where each period starts on the defined first day-of-week. The earliest period is referred to as week 0 if it has less than the minimal number of days and week 1 if it has at least the minimal number of days.

<table class=striped style="text-align: left"> <caption>Examples of WeekFields</caption> <thead> <tr><th scope="col">Date</th><th scope="col">Day-of-week</th> <th scope="col">First day: Monday<br>Minimal days: 4</th><th scope="col">First day: Monday<br>Minimal days: 5</th></tr> </thead> <tbody> <tr><th scope="row">2008-12-31</th><td>Wednesday</td> <td>Week 5 of December 2008</td><td>Week 5 of December 2008</td></tr> <tr><th scope="row">2009-01-01</th><td>Thursday</td> <td>Week 1 of January 2009</td><td>Week 0 of January 2009</td></tr> <tr><th scope="row">2009-01-04</th><td>Sunday</td> <td>Week 1 of January 2009</td><td>Week 0 of January 2009</td></tr> <tr><th scope="row">2009-01-05</th><td>Monday</td> <td>Week 2 of January 2009</td><td>Week 1 of January 2009</td></tr> </tbody> </table>

<h2>Week of Year</h2> One field is used: week-of-year. The calculation ensures that weeks never overlap a year boundary. The year is divided into periods where each period starts on the defined first day-of-week. The earliest period is referred to as week 0 if it has less than the minimal number of days and week 1 if it has at least the minimal number of days.

<h2>Week Based Year</h2> Two fields are used for week-based-year, one for the #weekOfWeekBasedYear() week-of-week-based-year and one for #weekBasedYear() week-based-year. In a week-based-year, each week belongs to only a single year. Week 1 of a year is the first week that starts on the first day-of-week and has at least the minimum number of days. The first and last weeks of a year may contain days from the previous calendar year or next calendar year respectively.

<table class=striped style="text-align: left;"> <caption>Examples of WeekFields for week-based-year</caption> <thead> <tr><th scope="col">Date</th><th scope="col">Day-of-week</th> <th scope="col">First day: Monday<br>Minimal days: 4</th><th scope="col">First day: Monday<br>Minimal days: 5</th></tr> </thead> <tbody> <tr><th scope="row">2008-12-31</th><td>Wednesday</td> <td>Week 1 of 2009</td><td>Week 53 of 2008</td></tr> <tr><th scope="row">2009-01-01</th><td>Thursday</td> <td>Week 1 of 2009</td><td>Week 53 of 2008</td></tr> <tr><th scope="row">2009-01-04</th><td>Sunday</td> <td>Week 1 of 2009</td><td>Week 53 of 2008</td></tr> <tr><th scope="row">2009-01-05</th><td>Monday</td> <td>Week 2 of 2009</td><td>Week 1 of 2009</td></tr> </tbody> </table>

Added in 1.8.

Java documentation for java.time.temporal.WeekFields.

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.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
FirstDayOfWeek

Gets the first day-of-week.

Handle

The handle to the underlying Android instance.

(Inherited from Object)
Iso

The ISO-8601 definition, where a week starts on Monday and the first week has a minimum of 4 days.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
MinimalDaysInFirstWeek

Gets the minimal number of days in the first week.

PeerReference (Inherited from Object)
SundayStart

The common definition of a week that starts on Sunday and the first week has a minimum of 1 day.

ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
WeekBasedYears

The unit that represents week-based-years for the purpose of addition and subtraction.

Methods

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DayOfWeek()

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

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Of(DayOfWeek, Int32)

Obtains an instance of WeekFields from the first day-of-week and minimal days.

Of(Locale)

Obtains an instance of WeekFields appropriate for a locale.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WeekBasedYear()

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

WeekOfMonth()

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

WeekOfWeekBasedYear()

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

WeekOfYear()

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

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to