Uses of Class
java.time.YearMonth
Packages that use YearMonth
-
Uses of YearMonth in java.time
Modifier and TypeMethodDescriptionYear.atMonth(int month)
Combines this year with a month to create aYearMonth
.Combines this year with a month to create aYearMonth
.static YearMonth
YearMonth.from(TemporalAccessor temporal)
Obtains an instance ofYearMonth
from a temporal object.YearMonth.minus(long amountToSubtract, TemporalUnit unit)
Returns a copy of this year-month with the specified amount subtracted.YearMonth.minus(TemporalAmount amountToSubtract)
Returns a copy of this year-month with the specified amount subtracted.YearMonth.minusMonths(long monthsToSubtract)
Returns a copy of thisYearMonth
with the specified number of months subtracted.YearMonth.minusYears(long yearsToSubtract)
Returns a copy of thisYearMonth
with the specified number of years subtracted.static YearMonth
YearMonth.now()
Obtains the current year-month from the system clock in the default time-zone.static YearMonth
Obtains the current year-month from the specified clock.static YearMonth
Obtains the current year-month from the system clock in the specified time-zone.static YearMonth
YearMonth.of(int year, int month)
Obtains an instance ofYearMonth
from a year and month.static YearMonth
Obtains an instance ofYearMonth
from a year and month.static YearMonth
YearMonth.parse(CharSequence text)
Obtains an instance ofYearMonth
from a text string such as2007-12
.static YearMonth
YearMonth.parse(CharSequence text, DateTimeFormatter formatter)
Obtains an instance ofYearMonth
from a text string using a specific formatter.YearMonth.plus(long amountToAdd, TemporalUnit unit)
Returns a copy of this year-month with the specified amount added.YearMonth.plus(TemporalAmount amountToAdd)
Returns a copy of this year-month with the specified amount added.YearMonth.plusMonths(long monthsToAdd)
Returns a copy of thisYearMonth
with the specified number of months added.YearMonth.plusYears(long yearsToAdd)
Returns a copy of thisYearMonth
with the specified number of years added.YearMonth.with(TemporalAdjuster adjuster)
Returns an adjusted copy of this year-month.YearMonth.with(TemporalField field, long newValue)
Returns a copy of this year-month with the specified field set to a new value.YearMonth.withMonth(int month)
Returns a copy of thisYearMonth
with the month-of-year altered.YearMonth.withYear(int year)
Returns a copy of thisYearMonth
with the year altered.Modifier and TypeMethodDescriptionint
Compares this year-month to another year-month.boolean
Checks if this year-month is after the specified year-month.boolean
Checks if this year-month is before the specified year-month.