{@code YearMonth} is an immutable date-time object that represents the combinationof a year and month. Any field that can be derived from a year and month, such as quarter-of-year, can be obtained.
This class does not store or represent a day, time or time-zone. For example, the value "October 2007" can be stored in a {@code YearMonth}.
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.
This is a value-based class; use of identity-sensitive operations (including reference equality ( {@code ==}), identity hash code, or synchronization) on instances of {@code YearMonth} may have unpredictable results and should be avoided.The {@code equals} method should be used for comparisons. @implSpec This class is immutable and thread-safe. @since 1.8
NOTE: This class only supports the two fields listed above. It is impossible to query any other fields, such as dayOfWeek or centuryOfEra.
Calculations on YearMonth are performed using a {@link Chronology}. This chronology is set to be in the UTC time zone for all calculations.
One use case for this class is to store a credit card expiry date, as that only references the year and month. This class can be used as the gYearMonth type in XML Schema.
Each individual field can be queried in two ways:
getMonthOfYear()
monthOfYear().get()
monthOfYear().get()
monthOfYear().getAsText()
monthOfYear().getAsShortText()
monthOfYear().getMaximumValue()
monthOfYear().addToCopy()
monthOfYear().setCopy()
YearMonth is thread-safe and immutable, provided that the Chronology is as well. All standard Chronology classes supplied are thread-safe and immutable. @author Stephen Colebourne @since 2.0
{@code YearMonth} is an immutable date-time object that represents the combinationof a year and month. Any field that can be derived from a year and month, such as quarter-of-year, can be obtained.
This class does not store or represent a day, time or time-zone. For example, the value "October 2007" can be stored in a {@code YearMonth}.
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|