Package net.time4j.range
Class Months
- All Implemented Interfaces:
Serializable,Comparable<Months>,TimeSpan<CalendarUnit>
Represents a time span in gregorian months.
- Since:
- 3.21/4.17
- Author:
- Meno Hochschild
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.time4j.engine.TimeSpan
TimeSpan.Item<U> -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic Monthsbetween(CalendarMonth m1, CalendarMonth m2)Determines the difference in months between given calendar months.static <T extends TimePoint<? super CalendarUnit, T>>
Monthsbetween(T t1, T t2)Determines the temporal distance between given dates/time-points in gregorian months.static Monthsof(int months)Obtains a time span in given gregorian months.static MonthsparsePeriod(String period)Parses the canonical ISO-8601-format "PnM" with possible preceding minus-char.Methods inherited from class net.time4j.range.SingleUnitTimeSpan
abs, addTo, compareTo, contains, equals, getAmount, getPartialAmount, getTotalLength, getUnit, hashCode, inverse, isEmpty, isNegative, isPositive, minus, minus, multipliedBy, plus, plus, subtractFrom, toStdDuration, toString, toString
-
Field Details
-
ZERO
Constant for zero gregorian months.
-
ONE
Constant for exactly one gregorian month.
-
-
Method Details
-
of
Obtains a time span in given gregorian months.
- Parameters:
months- count of gregorian months, maybe negative- Returns:
- time span in months
- See Also:
CalendarUnit.MONTHS
-
between
Determines the temporal distance between given dates/time-points in gregorian months.
- Type Parameters:
T- generic type of time-points- Parameters:
t1- first time-pointt2- second time-point- Returns:
- result of month difference
- See Also:
PlainDate,PlainTimestamp
-
between
Determines the difference in months between given calendar months.
- Parameters:
m1- first calendar monthm2- second calendar month- Returns:
- month difference
-
parsePeriod
Parses the canonical ISO-8601-format "PnM" with possible preceding minus-char.
- Parameters:
period- the formatted string to be parsed- Returns:
- parsed instance
- Throws:
ParseException- if given argument cannot be parsed
-