2007-Q2.
YearQuarter is an immutable date-time object that represents the combination
of a year and quarter. Any field that can be derived from a year and quarter can be obtained.
A quarter is defined by Quarter and Month#firstMonthOfQuarter() - Q1, Q2, Q3 and Q4.
Q1 is January to March, Q2 is April to June, Q3 is July to September and Q4 is October to December.
This class does not store or represent a day, time or time-zone.
For example, the value "2nd quarter 2007" can be stored in a YearQuarter.
The ISO-8601 calendar system is the modern civil calendar system used today in most of the world. It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time. For most applications written today, the ISO-8601 rules are entirely suitable. However, any application that makes use of historical dates, and requires them to be accurate will find the ISO-8601 approach unsuitable. Note that the ISO-8601 standard does not define or refer to quarters.
This class must be treated as a value type. Do not synchronize, rely on the identity hash code or use the distinction between equals() and ==.
| Modifier and Type | Field and Description |
|---|---|
| private static final DateTimeFormatter | PARSER
Parser. |
| private final Quarter | quarter
The quarter-of-year, not null. |
| private static final long | serialVersionUID
Serialization version. |
| private final int | year
The year. |
| Access | Constructor and Description |
|---|---|
| private | YearQuarter(int
the year to represent, validated from MIN_YEAR to MAX_YEAR year, Quarter the quarter-of-year to represent, validated not null quarter)Constructor. |
| Modifier and Type | Method and Description |
|---|---|
| public Temporal | Returns: the adjusted object, not nullthe target object to be adjusted, not null temporal)Implements java. Adjusts the specified temporal object to have this year-quarter. |
| public LocalDate | Returns: the date formed from this year-quarter and the specified day, not nullthe day-of-quarter to use, from 1 to 92 dayOfQuarter)Combines this year-quarter with a day-of-quarter to create a |
| public LocalDate | Returns: the last valid date of this year-quarter, not nullReturns a |
| public int | Returns: the comparator value, negative if less, positive if greaterthe other year-quarter to compare to, not null other)Implements java. Compares this year-quarter to another The comparison is based first on the value of the year, then on the value of the quarter. |
| public boolean | Returns: true if this is equal to the other year-quarterthe object to check, null returns false obj)Overrides java. Checks if this year-quarter is equal to another year-quarter. |
| public String | Returns: the formatted year-quarter string, not nullthe formatter to use, not null formatter)Formats this year-quarter using the specified formatter. |
| public static YearQuarter | Returns: the year-quarter, not nullthe temporal object to convert, not null temporal)Obtains an instance of |
| public int | Returns: the value for the fieldthe field to get, not null field)Overrides default java. Gets the value of the specified field from this year-quarter as an |
| public long | Returns: the value for the fieldthe field to get, not null field)Implements java. Gets the value of the specified field from this year-quarter as a |
| private long | |
| public Quarter | Returns: the quarter-of-year, not nullGets the quarter-of-year field using the |
| public int | Returns: the quarter-of-year, from 1 to 4Gets the quarter-of-year field from 1 to 4. |
| public int | |
| public int | Returns: a suitable hash codeOverrides java. A hash code for this year-quarter. |
| public boolean | Returns: true if this is after the specified year-quarterthe other year-quarter to compare to, not null other)Is this year-quarter after the specified year-quarter. |
| public boolean | Returns: true if this point is before the specified year-quarterthe other year-quarter to compare to, not null other)Is this year-quarter before the specified year-quarter. |
| public boolean | Returns: true if the year is leap, false otherwiseChecks if the year is a leap year, according to the ISO proleptic calendar system rules. |
| public boolean | Returns: true if the field is supported on this year-quarter, false if notthe field to check, null returns false field)Implements java. Checks if the specified field is supported. |
| public boolean | Returns: true if the unit can be added/subtracted, false if notthe unit to check, null returns false unit)Implements java. Checks if the specified unit is supported. |
| public boolean | Returns: true if the day is valid for this year-quarterthe day-of-quarter to validate, from 1 to 92, invalid value returns false dayOfQuarter)Checks if the day-of-quarter is valid for this year-quarter. |
| public int | Returns: the length of the quarter in days, from 90 to 92Returns the length of the quarter, taking account of the year. |
| public int | |
| public YearQuarter | Returns: aYearQuarter based on this year-quarter with the subtraction made, not nullthe amount to subtract, not null amountToSubtract)Overrides default java. Returns a copy of this year-quarter with the specified amount subtracted. |
| public YearQuarter | Returns: aYearQuarter based on this year-quarter with the specified amount subtracted, not nullthe amount of the unit to subtract from the result, may be negative amountToSubtract, TemporalUnit the unit of the amount to subtract, not null unit)Overrides default java. Returns a copy of this year-quarter with the specified amount subtracted. |
| public YearQuarter | Returns: aYearQuarter based on this year-quarter with the quarters subtracted, not nullthe quarters to subtract, may be negative quartersToSubtract)Returns a copy of this year-quarter with the specified period in quarters subtracted. |
| public YearQuarter | Returns: aYearQuarter based on this year-quarter with the years subtracted, not nullthe years to subtract, may be negative yearsToSubtract)Returns a copy of this year-quarter with the specified period in years subtracted. |
| public static YearQuarter | Returns: the current year-quarter using the system clock and default time-zone, not nullObtains the current year-quarter from the system clock in the default time-zone. |
| public static YearQuarter | |
| public static YearQuarter | |
| public static YearQuarter | |
| public static YearQuarter | |
| public static YearQuarter | |
| public static YearQuarter | Returns: the year-quarter, not nullthe year to represent, from MIN_YEAR to MAX_YEAR year, int the quarter-of-year to represent, from 1 to 4 quarter)Obtains an instance of |
| public static YearQuarter | Returns: the parsed year-quarter, not nullthe text to parse such as "2007-Q2", not null text)Obtains an instance of |
| public static YearQuarter | Returns: the parsed year-quarter, not nullthe text to parse, not null text, DateTimeFormatter the formatter to use, not null formatter)Obtains an instance of |
| public YearQuarter | Returns: aYearQuarter based on this year-quarter with the addition made, not nullthe amount to add, not null amountToAdd)Overrides default java. Returns a copy of this year-quarter with the specified amount added. |
| public YearQuarter | Returns: aYearQuarter based on this year-quarter with the specified amount added, not nullthe amount of the unit to add to the result, may be negative amountToAdd, TemporalUnit the unit of the amount to add, not null unit)Implements java. Returns a copy of this year-quarter with the specified amount added. |
| public YearQuarter | Returns: aYearQuarter based on this year-quarter with the quarters added, not nullthe quarters to add, may be negative quartersToAdd)Returns a copy of this year-quarter with the specified period in quarters added. |
| public YearQuarter | Returns: aYearQuarter based on this year-quarter with the years added, not nullthe years to add, may be negative yearsToAdd)Returns a copy of this year-quarter with the specified period in years added. |
| public Stream | Returns: a sequentialStream for the range of YearQuarter valuesthe end year-quarter, exclusive, not null endExclusive)Returns a sequential ordered stream of year-quarter. |
| public < the type of the result R> R | Returns: the query result, null may be returned (defined by the query)the query to invoke, not null query)Overrides default java. Queries this year-quarter using the specified query. |
| public ValueRange | Returns: the range of valid values for the field, not nullthe field to query the range for, not null field)Overrides default java. Gets the range of valid values for the specified field. |
| private Object | |
| public String | Returns: a string representation of this year-quarter, not nullOverrides java. Outputs this year-quarter as a |
| public long | Returns: the amount of time between this year-quarter and the end year-quarterthe end date, exclusive, which is converted to a endExclusive, TemporalUnit YearQuarter, not nullthe unit to measure the amount in, not null unit)Implements java. Calculates the amount of time until another year-quarter in terms of the specified unit. |
| private YearQuarter | Returns: the year-quarter, not nullthe year to represent, validated from MIN_YEAR to MAX_YEAR newYear, Quarter the quarter-of-year to represent, validated not null newQuarter)Returns a copy of this year-quarter with the new year and quarter, checking to see if a new object is in fact required. |
| public YearQuarter | Returns: aYearQuarter based on this with the adjustment made, not nullthe adjuster to use, not null adjuster)Overrides default java. Returns an adjusted copy of this year-quarter. |
| public YearQuarter | Returns: aYearQuarter based on this with the specified field set, not nullthe field to set in the result, not null field, long the new value of the field in the result newValue)Implements java. Returns a copy of this year-quarter with the specified field set to a new value. |
| public YearQuarter | Returns: aYearQuarter based on this year-quarter with the requested quarter, not nullthe quarter-of-year to set in the returned year-quarter, from 1 to 4 quarter)Returns a copy of this |
| public YearQuarter | Returns: aYearQuarter based on this year-quarter with the requested year, not nullthe year to set in the returned year-quarter, from MIN_YEAR to MAX_YEAR year)Returns a copy of this |