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 object.
The computations for day-of-week, week-of-month, and week-of-year are based on the proleptic-year, month-of-year, day-of-month, and ISO day-of-week which are based on the epoch-day and the chronology. The values may not be aligned with the year-of-Era depending on the Chronology.
A week is defined by:
| Date | Day-of-week | First day: Monday Minimal days: 4 | First day: Monday Minimal days: 5 |
|---|---|---|---|
| 2008-12-31 | Wednesday | Week 5 of December 2008 | Week 5 of December 2008 |
| 2009-01-01 | Thursday | Week 1 of January 2009 | Week 0 of January 2009 |
| 2009-01-04 | Sunday | Week 1 of January 2009 | Week 0 of January 2009 |
| 2009-01-05 | Monday | Week 2 of January 2009 | Week 1 of January 2009 |
week-of-week-based-year and one for
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.
| Date | Day-of-week | First day: Monday Minimal days: 4 | First day: Monday Minimal days: 5 |
|---|---|---|---|
| 2008-12-31 | Wednesday | Week 1 of 2009 | Week 53 of 2008 |
| 2009-01-01 | Thursday | Week 1 of 2009 | Week 53 of 2008 |
| 2009-01-04 | Sunday | Week 1 of 2009 | Week 53 of 2008 |
| 2009-01-05 | Monday | Week 2 of 2009 | Week 1 of 2009 |
Implementation Specification
This class is immutable and thread-safe.
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | WeekFields.
Field type that computes DayOfWeek, WeekOfMonth, and WeekOfYear based on a WeekFields. |
| Modifier and Type | Field and Description |
|---|---|
| private static final ConcurrentMap | CACHE
The cache of rules by firstDayOfWeek plus minimalDays. |
| private final transient TemporalField | dayOfWeek
The field used to access the computed DayOfWeek. |
| private final DayOfWeek | |
| public static final WeekFields | ISO
The ISO-8601 definition, where a week starts on Monday and the first week has a minimum of 4 days. |
| private final int | |
| private static final long | serialVersionUID
Serialization version. |
| public static final WeekFields | SUNDAY_START
The common definition of a week that starts on Sunday and the first week has a minimum of 1 day. |
| public static final TemporalUnit | WEEK_BASED_YEARS
The unit that represents week-based-years for the purpose of addition and subtraction. |
| private final transient TemporalField | weekBasedYear
The field that represents the week-based-year. |
| private final transient TemporalField | weekOfMonth
The field used to access the computed WeekOfMonth. |
| private final transient TemporalField | weekOfWeekBasedYear
The field that represents the week-of-week-based-year. |
| private final transient TemporalField | weekOfYear
The field used to access the computed WeekOfYear. |
| Access | Constructor and Description |
|---|---|
| private | WeekFields(DayOfWeek
the first day of the week, not null firstDayOfWeek, int the minimal number of days in the first week, from 1 to 7 minimalDaysInFirstWeek)Creates an instance of the definition. |
| Modifier and Type | Method and Description |
|---|---|
| public TemporalField | Returns: a field providing access to the day-of-week with localized numbering, not nullReturns a field to access the day of week based on this |
| public boolean | Returns: true if this is equal to the specified rulesthe other rules to compare to, null returns false object)Overrides java. Checks if this |
| public DayOfWeek | |
| public int | Returns: the minimal number of days in the first week of a month or year, from 1 to 7Gets the minimal number of days in the first week. |
| public int | Returns: a suitable hash codeOverrides java. A hash code for this |
| public static WeekFields | |
| public static WeekFields | |
| private void | |
| private Object | Returns: the singleton WeekFields for the firstDayOfWeek and minimalDays.Return the singleton WeekFields associated with the
|
| public String | Returns: the string representation, not nullOverrides java. A string representation of this |
| public TemporalField | Returns: a field providing access to the week-based-year, not nullReturns a field to access the year of a week-based-year based on this |
| public TemporalField | Returns: a field providing access to the week-of-month, not nullReturns a field to access the week of month based on this |
| public TemporalField | Returns: a field providing access to the week-of-week-based-year, not nullReturns a field to access the week of a week-based-year based on this |
| public TemporalField | Returns: a field providing access to the week-of-year, not nullReturns a field to access the week of year based on this |
| CACHE | back to summary |
|---|---|
| private static final ConcurrentMap<String, WeekFields> CACHE The cache of rules by firstDayOfWeek plus minimalDays. Initialized first to be available for definition of ISO, etc. | |
| dayOfWeek | back to summary |
|---|---|
| private final transient TemporalField dayOfWeek The field used to access the computed DayOfWeek. | |
| firstDayOfWeek | back to summary |
|---|---|
| private final DayOfWeek firstDayOfWeek | |
| ISO | back to summary |
|---|---|
| public static final WeekFields ISO The ISO-8601 definition, where a week starts on Monday and the first week has a minimum of 4 days. The ISO-8601 standard defines a calendar system based on weeks. It uses the week-based-year and week-of-week-based-year concepts to split up the passage of days instead of the standard year/month/day. Note that the first week may start in the previous calendar year. Note also that the first few days of a calendar year may be in the week-based-year corresponding to the previous calendar year. | |
| minimalDays | back to summary |
|---|---|
| private final int minimalDays | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Serialization version. | |
| SUNDAY_START | back to summary |
|---|---|
| public static final WeekFields SUNDAY_START The common definition of a week that starts on Sunday and the first week has a minimum of 1 day. Defined as starting on Sunday and with a minimum of 1 day in the month. This week definition is in use in the US and other European countries. | |
| WEEK_BASED_YEARS | back to summary |
|---|---|
| public static final TemporalUnit WEEK_BASED_YEARS The unit that represents week-based-years for the purpose of addition and subtraction.
This allows a number of week-based-years to be added to, or subtracted from, a date.
The unit is equal to either 52 or 53 weeks.
The estimated duration of a week-based-year is the same as that of a standard ISO
year at The rules for addition add the number of week-based-years to the existing value for the week-based-year field retaining the week-of-week-based-year and day-of-week, unless the week number it too large for the target year. In that case, the week is set to the last week of the year with the same day-of-week. This unit is an immutable and thread-safe singleton. | |
| weekBasedYear | back to summary |
|---|---|
| private final transient TemporalField weekBasedYear The field that represents the week-based-year. This field allows the week-based-year value to be queried and set. This unit is an immutable and thread-safe singleton. | |
| weekOfMonth | back to summary |
|---|---|
| private final transient TemporalField weekOfMonth The field used to access the computed WeekOfMonth. | |
| weekOfWeekBasedYear | back to summary |
|---|---|
| private final transient TemporalField weekOfWeekBasedYear The field that represents the week-of-week-based-year. This field allows the week of the week-based-year value to be queried and set. This unit is an immutable and thread-safe singleton. | |
| weekOfYear | back to summary |
|---|---|
| private final transient TemporalField weekOfYear The field used to access the computed WeekOfYear. | |
| WeekFields | back to summary |
|---|---|
| private WeekFields(DayOfWeek firstDayOfWeek, int minimalDaysInFirstWeek) Creates an instance of the definition.
| |
| dayOfWeek | back to summary |
|---|---|
| public TemporalField dayOfWeek() Returns a field to access the day of week based on this
This is similar to For example, if the first day-of-week is Sunday, then that will have the value 1, with other days ranging from Monday as 2 to Saturday as 7.
In the resolving phase of parsing, a localized day-of-week will be converted
to a standardized
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object object) Overrides java. Checks if this The comparison is based on the entire state of the rules, which is the first day-of-week and minimal days. | |
| getFirstDayOfWeek | back to summary |
|---|---|
| public DayOfWeek getFirstDayOfWeek() Gets the first day-of-week.
The first day-of-week varies by culture.
For example, the US uses Sunday, while France and the ISO-8601 standard use Monday.
This method returns the first day using the standard
| |
| getMinimalDaysInFirstWeek | back to summary |
|---|---|
| public int getMinimalDaysInFirstWeek() Gets the minimal number of days in the first week. The number of days considered to define the first week of a month or year varies by culture. For example, the ISO-8601 requires 4 days (more than half a week) to be present before counting the first week.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. A hash code for this
| |
| of | back to summary |
|---|---|
| public static WeekFields of(Locale locale) Obtains an instance of This will look up appropriate values from the provider of localization data. If the locale contains "fw" (First day of week) and/or "rg" (Region Override) Unicode extensions, returned instance will reflect the values specified with those extensions. If both "fw" and "rg" are specified, the value from the "fw" extension supersedes the implicit one from the "rg" extension. For example, users who are interested in using an English locale, but want the first day of the week that corresponds with the ISO-8601 standard can call Locale enIsoLoc = Locale.forLanguageTag("en-u-fw-mon"); WeekFields.of(enIsoLoc).getFirstDayOfWeek(); // returns MONDAY
| |
| of | back to summary |
|---|---|
| public static WeekFields of(DayOfWeek firstDayOfWeek, int minimalDaysInFirstWeek) Obtains an instance of
The first day-of-week defines the ISO
WeekFields instances are singletons; for each unique combination
of
| |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException, InvalidObjectException Restore the state of a WeekFields from the stream. Check that the values are valid.
| |
| readResolve | back to summary |
|---|---|
| private Object readResolve() throws InvalidObjectException Return the singleton WeekFields associated with the
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. A string representation of this | |
| weekBasedYear | back to summary |
|---|---|
| public TemporalField weekBasedYear() Returns a field to access the year of a week-based-year based on this
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
Week one(1) is the week starting on the 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 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 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 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.
| |
| weekOfMonth | back to summary |
|---|---|
| public TemporalField weekOfMonth() Returns a field to access the week of month based on this
This represents the concept of the count of weeks within the month where weeks
start on a fixed day-of-week, such as Monday.
This field is typically used with
Week one (1) is the week starting on the
For example: This field can be used with any calendar system. In the resolving phase of parsing, a date can be created from a year, week-of-month, month-of-year and day-of-week. In strict mode, all four fields are validated against their range of valid values. The week-of-month field is validated to ensure that the resulting month is the month requested. In smart mode, all four fields are validated against their range of valid values. The week-of-month field is validated from 0 to 6, meaning that the resulting date can be in a different month to that specified. In 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 four stage approach. First, create a date on the first day of the first week of January in the requested year. Then take the month-of-year, subtract one, and add the amount in months to the date. Then take the week-of-month, subtract one, and add the amount in weeks to the date. Finally, adjust to the correct day-of-week within the localized week.
| |
| weekOfWeekBasedYear | back to summary |
|---|---|
| public TemporalField weekOfWeekBasedYear() Returns a field to access the week of a week-based-year based on this
This represents the concept of the count of weeks within 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
Week one(1) is the week starting on the
For example: 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 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 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 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.
| |
| weekOfYear | back to summary |
|---|---|
| public TemporalField weekOfYear() Returns a field to access the week of year based on this
This represents the concept of the count of weeks within the year where weeks
start on a fixed day-of-week, such as Monday.
This field is typically used with
Week one(1) is the week starting on the
For example: This field can be used with any calendar system. In the resolving phase of parsing, a date can be created from a year, week-of-year and day-of-week. In 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 year is the year requested. In smart mode, all three fields are validated against their range of valid values. The week-of-year field is validated from 0 to 54, meaning that the resulting date can be in a different year to that specified. In 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 year. Then take the week-of-year, subtract one, and add the amount in weeks to the date. Finally, adjust to the correct day-of-week within the localized week.
| |
| Modifier and Type | Field and Description |
|---|---|
| private final TemporalUnit | |
| private static final ValueRange | |
| private final String | |
| private final ValueRange | |
| private final TemporalUnit | |
| private static final ValueRange | |
| private static final ValueRange | |
| private static final ValueRange | |
| private final WeekFields |
| Access | Constructor and Description |
|---|---|
| private | ComputedDayOfField(String name, WeekFields weekDef, TemporalUnit baseUnit, TemporalUnit rangeUnit, ValueRange range)
|
| Modifier and Type | Method and Description |
|---|---|
| public <R extends Temporal> R | adjustInto(R temporal, long newValue)
Implements java. Returns a copy of the specified temporal object with the value of this field set. |
| private int | Returns: the week number where zero is used for a partial week and 1 for the first full weekthe offset to align a date with the start of week
from offset, int startOfWeekOffset.the day for which to compute the week number day)Returns the week number computed from the reference day and reference dayOfWeek. |
| public TemporalUnit | getBaseUnit()
Implements java. Gets the unit that the field is measured in. The unit of the field is the period that varies within the range. |
| public String | getDisplayName(Locale locale)
Overrides default java. Gets the display name for the field in the requested locale. |
| public long | getFrom(TemporalAccessor temporal)
Implements java. Gets the value of this field from the specified temporal object. |
| public TemporalUnit | getRangeUnit()
Implements java. Gets the range that the field is bound by. |
| public boolean | isDateBased()
Implements java. Checks if this field represents a component of a date. |
| public boolean | isSupportedBy(TemporalAccessor temporal)
Implements java. Checks if this field is supported by the temporal object. |
| public boolean | isTimeBased()
Implements java. Checks if this field represents a component of a time. |
| private int | |
| private int | |
| private int | Returns: the year of week-based-year for the datea date of any chronology, not null temporal)Returns the year of week-based-year for the temporal. |
| private long | |
| private int | Returns: the week of the yeara date of any chronology temporal)Returns the week of week-based-year for the temporal. |
| private long | |
| pack-priv static WeekFields. | ofDayOfWeekField(WeekFields weekDef)
Returns a field to access the day of week, computed based on a WeekFields. |
| private ChronoLocalDate | Returns: a ChronoLocalDate for the requested year, week of year, and day of weekThe chronology of the new date chrono, int the year of the week-based-year yowby, int the week of the week-based-year wowby, int the day of the week dow)Return a new week-based-year date of the Chronology, year, week-of-year, and dow of week. |
| pack-priv static WeekFields. | ofWeekBasedYearField(WeekFields weekDef)
Returns a field to access the week of week-based-year, computed based on a WeekFields. |
| pack-priv static WeekFields. | ofWeekOfMonthField(WeekFields weekDef)
Returns a field to access the week of month, computed based on a WeekFields. |
| pack-priv static WeekFields. | ofWeekOfWeekBasedYearField(WeekFields weekDef)
Returns a field to access the week of week-based-year, computed based on a WeekFields. |
| pack-priv static WeekFields. | ofWeekOfYearField(WeekFields weekDef)
Returns a field to access the week of year, computed based on a WeekFields. |
| public ValueRange | range()
Implements java. Gets the range of valid values for the field. |
| private ValueRange | Returns: the ValueRange with the range adjusted to weeks.the temporal temporal, TemporalField the field to get the range of field)Map the field range to a week range |
| public ValueRange | rangeRefinedBy(TemporalAccessor temporal)
Implements java. Get the range of valid values for this field using the temporal object to refine the result. |
| private ValueRange | Returns: the ValueRange with the range adjusted to weeks.the temporal temporal)Map the field range to a week range of a week year. |
| public ChronoLocalDate | resolve(Map<TemporalField, Long> fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle)
Overrides default java. Resolves this field to provide a simpler alternative or a date. |
| private ChronoLocalDate | resolveWBY(Map<TemporalField, Long> fieldValues, Chronology chrono, int localDow, ResolverStyle resolverStyle)
|
| private ChronoLocalDate | resolveWoM(Map<TemporalField, Long> fieldValues, Chronology chrono, int year, long month, long wom, int localDow, ResolverStyle resolverStyle)
|
| private ChronoLocalDate | resolveWoY(Map<TemporalField, Long> fieldValues, Chronology chrono, int year, long woy, int localDow, ResolverStyle resolverStyle)
|
| private int | Returns: an offset in days to align a day with the start of the first 'full' weekthe day; 1 through infinity day, int the day of the week of that day; 1 through 7 dow)Returns an offset to align week start with a day of month or day of year. |
| public String | toString()
Overrides java. Implements java. Gets a descriptive name for the field. |
| baseUnit | back to summary |
|---|---|
| private final TemporalUnit baseUnit | |
| DAY_OF_WEEK_RANGE | back to summary |
|---|---|
| private static final ValueRange DAY_OF_WEEK_RANGE | |
| name | back to summary |
|---|---|
| private final String name | |
| range | back to summary |
|---|---|
| private final ValueRange range | |
| rangeUnit | back to summary |
|---|---|
| private final TemporalUnit rangeUnit | |
| WEEK_OF_MONTH_RANGE | back to summary |
|---|---|
| private static final ValueRange WEEK_OF_MONTH_RANGE | |
| WEEK_OF_WEEK_BASED_YEAR_RANGE | back to summary |
|---|---|
| private static final ValueRange WEEK_OF_WEEK_BASED_YEAR_RANGE | |
| WEEK_OF_YEAR_RANGE | back to summary |
|---|---|
| private static final ValueRange WEEK_OF_YEAR_RANGE | |
| weekDef | back to summary |
|---|---|
| private final WeekFields weekDef | |
| ComputedDayOfField | back to summary |
|---|---|
| private ComputedDayOfField(String name, WeekFields weekDef, TemporalUnit baseUnit, TemporalUnit rangeUnit, ValueRange range) | |
| adjustInto | back to summary |
|---|---|
| public <R extends Temporal> R adjustInto(R temporal, long newValue) Implements java. Doc from java. Returns a copy of the specified temporal object with the value of this field set.
This returns a new temporal object based on the specified one with the value for
this field changed. For example, on a In some cases, changing a field is not fully defined. For example, if the target object is a date representing the 31st January, then changing the month to February would be unclear. In cases like this, the implementation is responsible for resolving the result. Typically it will choose the previous valid date, which would be the last valid day of February in this example.
There are two equivalent ways of using this method.
The first is to invoke this method directly.
The second is to use // these two lines are equivalent, but the second approach is recommended temporal = thisField.adjustInto(temporal, newValue); temporal = temporal.with(thisField, newValue);It is recommended to use the second approach, with(thisField, newValue),
as it is a lot clearer to read in code.
Implementations should perform any queries or calculations using the fields
available in Implementations must not alter the specified temporal object. Instead, an adjusted copy of the original must be returned. This provides equivalent, safe behavior for immutable and mutable implementations.
| |
| computeWeek | back to summary |
|---|---|
| private int computeWeek(int offset, int day) Returns the week number computed from the reference day and reference dayOfWeek.
| |
| getBaseUnit | back to summary |
|---|---|
| public TemporalUnit getBaseUnit() Implements java. Doc from java. Gets the unit that the field is measured in.
The unit of the field is the period that varies within the range.
For example, in the field 'MonthOfYear', the unit is 'Months'.
See also
| |
| getDisplayName | back to summary |
|---|---|
| public String getDisplayName(Locale locale) Overrides default java. Doc from java. Gets the display name for the field in the requested locale. If there is no display name for the locale then a suitable default must be returned.
The default implementation must check the locale is not null
and return
| |
| getFrom | back to summary |
|---|---|
| public long getFrom(TemporalAccessor temporal) Implements java. Doc from java. Gets the value of this field from the specified temporal object. This queries the temporal object for the value of this field.
There are two equivalent ways of using this method.
The first is to invoke this method directly.
The second is to use // these two lines are equivalent, but the second approach is recommended value = thisField.getFrom(temporal); value = temporal.getLong(thisField);It is recommended to use the second approach, getLong(thisField),
as it is a lot clearer to read in code.
Implementations should perform any queries or calculations using the fields
available in
| |
| getRangeUnit | back to summary |
|---|---|
| public TemporalUnit getRangeUnit() Implements java. Doc from java. Gets the range that the field is bound by.
The range of the field is the period that the field varies within.
For example, in the field 'MonthOfYear', the range is 'Years'.
See also The range is never null. For example, the 'Year' field is shorthand for 'YearOfForever'. It therefore has a unit of 'Years' and a range of 'Forever'.
| |
| isDateBased | back to summary |
|---|---|
| public boolean isDateBased() Implements java. Doc from java. Checks if this field represents a component of a date.
A field is date-based if it can be derived from
| |
| isSupportedBy | back to summary |
|---|---|
| public boolean isSupportedBy(TemporalAccessor temporal) Implements java. Doc from java. Checks if this field is supported by the temporal object. This determines whether the temporal accessor supports this field. If this returns false, then the temporal cannot be queried for this field.
There are two equivalent ways of using this method.
The first is to invoke this method directly.
The second is to use // these two lines are equivalent, but the second approach is recommended supported = thisField.isSupportedBy(temporal); supported = temporal.isSupported(thisField);It is recommended to use the second approach, isSupported(thisField),
as it is a lot clearer to read in code.
Implementations should determine whether they are supported using the fields
available in
| |
| isTimeBased | back to summary |
|---|---|
| public boolean isTimeBased() Implements java. Doc from java. Checks if this field represents a component of a time.
A field is time-based if it can be derived from
| |
| localizedDayOfWeek | back to summary |
|---|---|
| private int localizedDayOfWeek(TemporalAccessor temporal) | |
| localizedDayOfWeek | back to summary |
|---|---|
| private int localizedDayOfWeek(int isoDow) | |
| localizedWeekBasedYear | back to summary |
|---|---|
| private int localizedWeekBasedYear(TemporalAccessor temporal) Returns the year of week-based-year for the temporal. The year can be the previous year, the current year, or the next year.
| |
| localizedWeekOfMonth | back to summary |
|---|---|
| private long localizedWeekOfMonth(TemporalAccessor temporal) | |
| localizedWeekOfWeekBasedYear | back to summary |
|---|---|
| private int localizedWeekOfWeekBasedYear(TemporalAccessor temporal) Returns the week of week-based-year for the temporal. The week can be part of the previous year, the current year, or the next year depending on the week start and minimum number of days.
| |
| localizedWeekOfYear | back to summary |
|---|---|
| private long localizedWeekOfYear(TemporalAccessor temporal) | |
| ofDayOfWeekField | back to summary |
|---|---|
| pack-priv static WeekFields. Returns a field to access the day of week, computed based on a WeekFields. The WeekDefintion of the first day of the week is used with the ISO DAY_OF_WEEK field to compute week boundaries. | |
| ofWeekBasedYear | back to summary |
|---|---|
| private ChronoLocalDate ofWeekBasedYear(Chronology chrono, int yowby, int wowby, int dow) Return a new week-based-year date of the Chronology, year, week-of-year, and dow of week.
| |
| ofWeekBasedYearField | back to summary |
|---|---|
| pack-priv static WeekFields. Returns a field to access the week of week-based-year, computed based on a WeekFields.
| |
| ofWeekOfMonthField | back to summary |
|---|---|
| pack-priv static WeekFields. Returns a field to access the week of month, computed based on a WeekFields.
| |
| ofWeekOfWeekBasedYearField | back to summary |
|---|---|
| pack-priv static WeekFields. Returns a field to access the week of week-based-year, computed based on a WeekFields.
| |
| ofWeekOfYearField | back to summary |
|---|---|
| pack-priv static WeekFields. Returns a field to access the week of year, computed based on a WeekFields.
| |
| range | back to summary |
|---|---|
| public ValueRange range() Implements java. Doc from java. Gets the range of valid values for the field.
All fields can be expressed as a Note that the result only describes the minimum and maximum valid values and it is important not to read too much into them. For example, there could be values within the range that are invalid for the field.
| |
| rangeByWeek | back to summary |
|---|---|
| private ValueRange rangeByWeek(TemporalAccessor temporal, TemporalField field) Map the field range to a week range
| |
| rangeRefinedBy | back to summary |
|---|---|
| public ValueRange rangeRefinedBy(TemporalAccessor temporal) Implements java. Doc from java. Get the range of valid values for this field using the temporal object to refine the result.
This uses the temporal object to find the range of valid values for the field.
This is similar to
There are two equivalent ways of using this method.
The first is to invoke this method directly.
The second is to use // these two lines are equivalent, but the second approach is recommended range = thisField.rangeRefinedBy(temporal); range = temporal.range(thisField);It is recommended to use the second approach, range(thisField),
as it is a lot clearer to read in code.
Implementations should perform any queries or calculations using the fields
available in
| |
| rangeWeekOfWeekBasedYear | back to summary |
|---|---|
| private ValueRange rangeWeekOfWeekBasedYear(TemporalAccessor temporal) Map the field range to a week range of a week year.
| |
| resolve | back to summary |
|---|---|
| public ChronoLocalDate resolve(Map<TemporalField, Long> fieldValues, TemporalAccessor partialTemporal, ResolverStyle resolverStyle) Overrides default java. Doc from java. Resolves this field to provide a simpler alternative or a date.
This method is invoked during the resolve phase of parsing.
It is designed to allow application defined fields to be simplified into
more standard fields, such as those on Applications should not normally invoke this method directly.
| |
| resolveWBY | back to summary |
|---|---|
| private ChronoLocalDate resolveWBY(Map<TemporalField, Long> fieldValues, Chronology chrono, int localDow, ResolverStyle resolverStyle) | |
| resolveWoM | back to summary |
|---|---|
| private ChronoLocalDate resolveWoM(Map<TemporalField, Long> fieldValues, Chronology chrono, int year, long month, long wom, int localDow, ResolverStyle resolverStyle) | |
| resolveWoY | back to summary |
|---|---|
| private ChronoLocalDate resolveWoY(Map<TemporalField, Long> fieldValues, Chronology chrono, int year, long woy, int localDow, ResolverStyle resolverStyle) | |
| startOfWeekOffset | back to summary |
|---|---|
| private int startOfWeekOffset(int day, int dow) Returns an offset to align week start with a day of month or day of year.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Implements java. Doc from java. Gets a descriptive name for the field.
The should be of the format 'BaseOfRange', such as 'MonthOfYear',
unless the field has a range of
| |