- java.lang.Object
-
- org.threeten.extra.TemporalFields
-
public final class TemporalFields extends Object
Additional Temporal fields.This provides additional fields and units not in the JDK.
-
-
Field Summary
Fields Modifier and Type Field Description static TemporalField
DAY_OF_HALF
The field that represents the day-of-half.static TemporalField
HALF_OF_YEAR
The field that represents the half-of-year.static TemporalUnit
HALF_YEARS
Unit that represents the concept of a half-year.
-
-
-
Field Detail
-
DAY_OF_HALF
public static final TemporalField DAY_OF_HALF
The field that represents the day-of-half.This field allows the day-of-half value to be queried and set. The day-of-half has values from 1 to 181 in H1 of a standard year, from 1 to 182 in H1 of a leap year and from 1 to 184 in H2.
The day-of-half can only be calculated if the day-of-year, month-of-year and year are available.
When setting this field, the value is allowed to be partially lenient, taking any value from 1 to 184. If the half has less than 184 days, then the day will end up in the following half-year.
In the resolving phase of parsing, a date can be created from a year, half-of-year and day-of-half.
In strict mode, all three fields are validated against their range of valid values. The day-of-half field is validated from 1 to 181, 182 or 184 depending on the year and half.
In smart mode, all three fields are validated against their range of valid values. The day-of-half field is validated between 1 and 184, ignoring the actual range based on the year and half. If the day-of-half exceeds the actual range, then the resulting date is in the next half-year.
In lenient mode, only the year is 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 of January in the requested year. Then take the half-of-year, subtract one, and add the amount in halves to the date. Finally, take the day-of-half, subtract one, and add the amount in days to the date.
This unit is an immutable and thread-safe singleton.
-
HALF_OF_YEAR
public static final TemporalField HALF_OF_YEAR
The field that represents the half-of-year.This field allows the half-of-year value to be queried and set. The half-of-year has values from 1 to 2.
The half-of-year can only be calculated if the month-of-year is available.
In the resolving phase of parsing, a date can be created from a year, half-of-year and day-of-half. See
DAY_OF_HALF
for details.This unit is an immutable and thread-safe singleton.
-
HALF_YEARS
public static final TemporalUnit HALF_YEARS
Unit that represents the concept of a half-year. For the ISO calendar system, it is equal to 6 months. The estimated duration of a half-year is one half of365.2425 Days
.This unit is an immutable and thread-safe singleton.
-
-