Uses of Class
java.time.YearMonth
| Package | Description |
|---|---|
| java.time |
The main API for dates, times, instants, and durations.
|
-
Uses of YearMonth in java.time
Methods in java.time that return YearMonth Modifier and Type Method Description YearMonthYear. atMonth(int month)Combines this year with a month to create aYearMonth.YearMonthYear. atMonth(Month month)Combines this year with a month to create aYearMonth.static YearMonthYearMonth. from(TemporalAccessor temporal)Obtains an instance ofYearMonthfrom a temporal object.YearMonthYearMonth. minus(long amountToSubtract, TemporalUnit unit)Returns a copy of this year-month with the specified amount subtracted.YearMonthYearMonth. minus(TemporalAmount amountToSubtract)Returns a copy of this year-month with the specified amount subtracted.YearMonthYearMonth. minusMonths(long monthsToSubtract)Returns a copy of thisYearMonthwith the specified number of months subtracted.YearMonthYearMonth. minusYears(long yearsToSubtract)Returns a copy of thisYearMonthwith the specified number of years subtracted.static YearMonthYearMonth. now()Obtains the current year-month from the system clock in the default time-zone.static YearMonthYearMonth. now(Clock clock)Obtains the current year-month from the specified clock.static YearMonthYearMonth. now(ZoneId zone)Obtains the current year-month from the system clock in the specified time-zone.static YearMonthYearMonth. of(int year, int month)Obtains an instance ofYearMonthfrom a year and month.static YearMonthYearMonth. of(int year, Month month)Obtains an instance ofYearMonthfrom a year and month.static YearMonthYearMonth. parse(CharSequence text)Obtains an instance ofYearMonthfrom a text string such as2007-12.static YearMonthYearMonth. parse(CharSequence text, DateTimeFormatter formatter)Obtains an instance ofYearMonthfrom a text string using a specific formatter.YearMonthYearMonth. plus(long amountToAdd, TemporalUnit unit)Returns a copy of this year-month with the specified amount added.YearMonthYearMonth. plus(TemporalAmount amountToAdd)Returns a copy of this year-month with the specified amount added.YearMonthYearMonth. plusMonths(long monthsToAdd)Returns a copy of thisYearMonthwith the specified number of months added.YearMonthYearMonth. plusYears(long yearsToAdd)Returns a copy of thisYearMonthwith the specified number of years added.YearMonthYearMonth. with(TemporalAdjuster adjuster)Returns an adjusted copy of this year-month.YearMonthYearMonth. with(TemporalField field, long newValue)Returns a copy of this year-month with the specified field set to a new value.YearMonthYearMonth. withMonth(int month)Returns a copy of thisYearMonthwith the month-of-year altered.YearMonthYearMonth. withYear(int year)Returns a copy of thisYearMonthwith the year altered.Methods in java.time with parameters of type YearMonth Modifier and Type Method Description intYearMonth. compareTo(YearMonth other)Compares this year-month to another year-month.booleanYearMonth. isAfter(YearMonth other)Checks if this year-month is after the specified year-month.booleanYearMonth. isBefore(YearMonth other)Checks if this year-month is before the specified year-month.