U - generic type of year unitspublic final class Years<U extends IsoDateUnit> extends SingleUnitTimeSpan<U,Years<U>>
Represents a time span in gregorian or week-based years.
TimeSpan.Item<U>| Modifier and Type | Field and Description |
|---|---|
static Years<CalendarUnit> |
ONE
Constant for exactly one gregorian year.
|
static Years<CalendarUnit> |
ZERO
Constant for zero gregorian years.
|
| Modifier and Type | Method and Description |
|---|---|
static Years<CalendarUnit> |
between(CalendarMonth m1,
CalendarMonth m2)
Determines the difference in years between given calendar months.
|
static Years<CalendarUnit> |
between(CalendarQuarter q1,
CalendarQuarter q2)
Determines the difference in years between given quarter years.
|
static Years<Weekcycle> |
between(CalendarWeek w1,
CalendarWeek w2)
Determines the difference in years between given calendar weeks.
|
static Years<CalendarUnit> |
between(CalendarYear y1,
CalendarYear y2)
Determines the difference in years between given calendar years.
|
static <T extends TimePoint<? super CalendarUnit,T>> |
between(T t1,
T t2)
Determines the temporal distance between given dates/time-points in gregorian years.
|
static Years<CalendarUnit> |
ofGregorian(int years)
Obtains a time span in given gregorian years.
|
static Years<Weekcycle> |
ofWeekBased(int years)
Obtains a time span in given week-based years.
|
static Years<CalendarUnit> |
parseGregorian(String period)
Parses the canonical ISO-8601-format "PnY" with possible preceding minus-char.
|
static Years<Weekcycle> |
parseWeekBased(String period)
Like
parseGregorian(period) but interpretes years as week-based. |
abs, addTo, compareTo, contains, equals, getAmount, getPartialAmount, getTotalLength, getUnit, hashCode, inverse, isEmpty, isNegative, isPositive, minus, minus, multipliedBy, plus, plus, subtractFrom, toStdDuration, toString, toStringpublic static final Years<CalendarUnit> ZERO
Constant for zero gregorian years.
public static final Years<CalendarUnit> ONE
Constant for exactly one gregorian year.
public static Years<CalendarUnit> ofGregorian(int years)
Obtains a time span in given gregorian years.
years - count of gregorian years, maybe negativeCalendarUnit.YEARSpublic static Years<Weekcycle> ofWeekBased(int years)
Obtains a time span in given week-based years.
Week-based years have a length of either 364 or 371 days.
years - count of week-based years, maybe negativeCalendarUnit.weekBasedYears()public static <T extends TimePoint<? super CalendarUnit,T>> Years<CalendarUnit> between(T t1, T t2)
Determines the temporal distance between given dates/time-points in gregorian years.
T - generic type of time-pointst1 - first time-pointt2 - second time-pointPlainDate,
PlainTimestamppublic static Years<CalendarUnit> between(CalendarYear y1, CalendarYear y2)
Determines the difference in years between given calendar years.
y1 - first calendar yeary2 - second calendar yearpublic static Years<CalendarUnit> between(CalendarQuarter q1, CalendarQuarter q2)
Determines the difference in years between given quarter years.
q1 - first quarter yearq2 - second quarter yearpublic static Years<CalendarUnit> between(CalendarMonth m1, CalendarMonth m2)
Determines the difference in years between given calendar months.
m1 - first calendar monthm2 - second calendar monthpublic static Years<Weekcycle> between(CalendarWeek w1, CalendarWeek w2)
Determines the difference in years between given calendar weeks.
w1 - first calendar weekw2 - second calendar weekpublic static Years<CalendarUnit> parseGregorian(String period) throws ParseException
Parses the canonical ISO-8601-format "PnY" with possible preceding minus-char.
period - the formatted string to be parsedParseException - if given argument cannot be parsedpublic static Years<Weekcycle> parseWeekBased(String period) throws ParseException
Like parseGregorian(period) but interpretes years as week-based.
period - the formatted string to be parsedParseException - if given argument cannot be parsedparseGregorian(String),
CalendarUnit.weekBasedYears()Copyright © 2014–2021. All rights reserved.