This includes:
TimeUnit and ChronoUnit
| Modifier and Type | Class and Description |
|---|---|
| private static enum | Temporals.
Enum implementing the adjusters. |
| private static class | Temporals.
Useful Duration constants expressed as BigDecimal seconds with a scale of 9. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static ChronoUnit | Returns: the converted unit, not nullthe unit to convert, not null unit)Converts a |
| public static long[] | Returns: the conversion array, element 0 is the signed whole number, element 1 is the signed remainder in terms of the input unit, not nullthe input amount in terms of the amount, TemporalUnit fromUnitthe unit to convert from, not null fromUnit, TemporalUnit the unit to convert to, not null toUnit)Converts an amount from one unit to another. |
| public static Duration | Returns: aDuration, not nullthe number of seconds to convert, positive or negative seconds)Converts a |
| public static Duration | Returns: aDuration, not nullthe number of seconds to convert, positive or negative seconds)Converts a |
| public static BigDecimal | Returns: theBigDecimal equivalent of the duration, in seconds with a scale of 9the duration to convert, not null duration)Converts a duration to a |
| public static double | Returns: thedouble equivalent of the duration, in secondsthe duration to convert, not null duration)Converts a duration to a |
| private static boolean | |
| private static int | |
| public static Duration | |
| public static TemporalAdjuster | Returns: the next working day adjuster, not nullReturns an adjuster that returns the next working day, ignoring Saturday and Sunday. |
| public static TemporalAdjuster | Returns: the next working day or same adjuster, not nullReturns an adjuster that returns the next working day or same day if already working day, ignoring Saturday and Sunday. |
| public static < the type of the parsed date-time T> T | Returns: the parsed date-time, not nullthe text to parse, not null text, TemporalQuery<T> the query defining the type to parse to, not null query, DateTimeFormatter... the formatters to try, not null formatters)Parses the text using one of the formatters. |
| public static TemporalAdjuster | Returns: the previous working day adjuster, not nullReturns an adjuster that returns the previous working day, ignoring Saturday and Sunday. |
| public static TemporalAdjuster | Returns: the previous working day or same adjuster, not nullReturns an adjuster that returns the previous working day or same day if already working day, ignoring Saturday and Sunday. |
| public static TimeUnit | Returns: the converted unit, not nullthe unit to convert, not null unit)Converts a |
| private static void |
| Temporals | back to summary |
|---|---|
| private Temporals() Restricted constructor. | |
| chronoUnit | back to summary |
|---|---|
| public static ChronoUnit chronoUnit(TimeUnit unit) Converts a
This handles the seven units declared in
| |
| convertAmount | back to summary |
|---|---|
| public static long[] convertAmount(long amount, TemporalUnit fromUnit, TemporalUnit toUnit) Converts an amount from one unit to another.
This works on the units in
| |
| durationFromBigDecimalSeconds | back to summary |
|---|---|
| public static Duration durationFromBigDecimalSeconds(BigDecimal seconds) Converts a
No exception is thrown by this method.
Numbers are rounded up to the nearest nanosecond (away from zero).
The duration will saturate at the biggest positive or negative
| |
| durationFromDoubleSeconds | back to summary |
|---|---|
| public static Duration durationFromDoubleSeconds(double seconds) Converts a
No exception is thrown by this method.
Numbers are rounded up to the nearest nanosecond (away from zero).
The duration will saturate at the biggest positive or negative
| |
| durationToBigDecimalSeconds | back to summary |
|---|---|
| public static BigDecimal durationToBigDecimalSeconds(Duration duration) Converts a duration to a
| |
| durationToDoubleSeconds | back to summary |
|---|---|
| public static double durationToDoubleSeconds(Duration duration) Converts a duration to a
| |
| isPrecise | back to summary |
|---|---|
| private static boolean isPrecise(TemporalUnit unit) | |
| monthMonthFactor | back to summary |
|---|---|
| private static int monthMonthFactor(TemporalUnit unit, TemporalUnit fromUnit, TemporalUnit toUnit) | |
| multiply | back to summary |
|---|---|
| public static Duration multiply(Duration duration, double multiplicand) Multiplies a duration by a
The amount is rounded away from zero, thus the result is only zero if zero is passed in.
See | |
| nextWorkingDay | back to summary |
|---|---|
| public static TemporalAdjuster nextWorkingDay() Returns an adjuster that returns the next working day, ignoring Saturday and Sunday. Some territories have weekends that do not consist of Saturday and Sunday. No implementation is supplied to support this, however an adjuster can be easily written to do so.
| |
| nextWorkingDayOrSame | back to summary |
|---|---|
| public static TemporalAdjuster nextWorkingDayOrSame() Returns an adjuster that returns the next working day or same day if already working day, ignoring Saturday and Sunday. Some territories have weekends that do not consist of Saturday and Sunday. No implementation is supplied to support this, however an adjuster can be easily written to do so.
| |
| parseFirstMatching | back to summary |
|---|---|
| public static <T> T parseFirstMatching(CharSequence text, TemporalQuery<T> query, DateTimeFormatter... formatters) Parses the text using one of the formatters.
This will try each formatter in turn, attempting to fully parse the specified text.
The temporal query is typically a method reference to a LocalDateTime dt = Temporals.parseFirstMatching(str, LocalDateTime::from, fmt1, fm2, fm3);If the parse completes without reading the entire length of the text, or a problem occurs during parsing or merging, then an exception is thrown.
| |
| previousWorkingDay | back to summary |
|---|---|
| public static TemporalAdjuster previousWorkingDay() Returns an adjuster that returns the previous working day, ignoring Saturday and Sunday. Some territories have weekends that do not consist of Saturday and Sunday. No implementation is supplied to support this, however an adjuster can be easily written to do so.
| |
| previousWorkingDayOrSame | back to summary |
|---|---|
| public static TemporalAdjuster previousWorkingDayOrSame() Returns an adjuster that returns the previous working day or same day if already working day, ignoring Saturday and Sunday. Some territories have weekends that do not consist of Saturday and Sunday. No implementation is supplied to support this, however an adjuster can be easily written to do so.
| |
| timeUnit | back to summary |
|---|---|
| public static TimeUnit timeUnit(ChronoUnit unit) Converts a
This handles the seven units declared in
| |
| validateUnit | back to summary |
|---|---|
| private static void validateUnit(TemporalUnit unit) | |
| Modifier and Type | Field and Description |
|---|---|
| public static final Temporals. | NEXT_WORKING
Next working day adjuster. |
| public static final Temporals. | NEXT_WORKING_OR_SAME
Next working day or same adjuster. |
| public static final Temporals. | PREVIOUS_WORKING
Previous working day adjuster. |
| public static final Temporals. | PREVIOUS_WORKING_OR_SAME
Previous working day or same adjuster. |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public static Temporals. | |
| public static Temporals. |
| NEXT_WORKING | back to summary |
|---|---|
| public static final Temporals. Next working day adjuster. | |
| NEXT_WORKING_OR_SAME | back to summary |
|---|---|
| public static final Temporals. Next working day or same adjuster. | |
| PREVIOUS_WORKING | back to summary |
|---|---|
| public static final Temporals. Previous working day adjuster. | |
| PREVIOUS_WORKING_OR_SAME | back to summary |
|---|---|
| public static final Temporals. Previous working day or same adjuster. | |
| Adjuster | back to summary |
|---|---|
| private Adjuster() | |
| valueOf | back to summary |
|---|---|
| public static Temporals. | |
| values | back to summary |
|---|---|
| public static Temporals. | |
| Modifier and Type | Field and Description |
|---|---|
| public static final BigDecimal | |
| public static final BigDecimal |
| Access | Constructor and Description |
|---|---|
| private |
| MAX | back to summary |
|---|---|
| public static final BigDecimal MAX | |
| MIN | back to summary |
|---|---|
| public static final BigDecimal MIN | |
| BigDecimalSeconds | back to summary |
|---|---|
| private BigDecimalSeconds() | |