Uses of Class
java.time.Year
| Package | Description |
|---|---|
| java.time |
The main API for dates, times, instants, and durations.
|
-
Uses of Year in java.time
Methods in java.time that return Year Modifier and Type Method Description static YearYear. from(TemporalAccessor temporal)Obtains an instance ofYearfrom a temporal object.YearYear. minus(long amountToSubtract, TemporalUnit unit)Returns a copy of this year with the specified amount subtracted.YearYear. minus(TemporalAmount amountToSubtract)Returns a copy of this year with the specified amount subtracted.YearYear. minusYears(long yearsToSubtract)Returns a copy of thisYearwith the specified number of years subtracted.static YearYear. now()Obtains the current year from the system clock in the default time-zone.static YearYear. now(Clock clock)Obtains the current year from the specified clock.static YearYear. now(ZoneId zone)Obtains the current year from the system clock in the specified time-zone.static YearYear. of(int isoYear)Obtains an instance ofYear.static YearYear. parse(CharSequence text)Obtains an instance ofYearfrom a text string such as2007.static YearYear. parse(CharSequence text, DateTimeFormatter formatter)Obtains an instance ofYearfrom a text string using a specific formatter.YearYear. plus(long amountToAdd, TemporalUnit unit)Returns a copy of this year with the specified amount added.YearYear. plus(TemporalAmount amountToAdd)Returns a copy of this year with the specified amount added.YearYear. plusYears(long yearsToAdd)Returns a copy of thisYearwith the specified number of years added.YearYear. with(TemporalAdjuster adjuster)Returns an adjusted copy of this year.YearYear. with(TemporalField field, long newValue)Returns a copy of this year with the specified field set to a new value.Methods in java.time with parameters of type Year Modifier and Type Method Description intYear. compareTo(Year other)Compares this year to another year.booleanYear. isAfter(Year other)Checks if this year is after the specified year.booleanYear. isBefore(Year other)Checks if this year is before the specified year.