public final class Temporals extends Object
This includes:
TimeUnit and ChronoUnit
| Modifier and Type | Method and Description |
|---|---|
static ChronoUnit |
chronoUnit(TimeUnit unit)
Converts a
TimeUnit to a ChronoUnit. |
static long[] |
convertAmount(long amount,
TemporalUnit fromUnit,
TemporalUnit toUnit)
Converts an amount from one unit to another.
|
static TemporalAdjuster |
nextWorkingDay()
Returns an adjuster that returns the next working day, ignoring Saturday and Sunday.
|
static TemporalAdjuster |
previousWorkingDay()
Returns an adjuster that returns the previous working day, ignoring Saturday and Sunday.
|
static TimeUnit |
timeUnit(ChronoUnit unit)
Converts a
ChronoUnit to a TimeUnit. |
public static TemporalAdjuster nextWorkingDay()
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.
public static TemporalAdjuster previousWorkingDay()
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.
public static ChronoUnit chronoUnit(TimeUnit unit)
TimeUnit to a ChronoUnit.
This handles the seven units declared in TimeUnit.
unit - the unit to convert, not nullpublic static TimeUnit timeUnit(ChronoUnit unit)
ChronoUnit to a TimeUnit.
This handles the seven units declared in TimeUnit.
unit - the unit to convert, not nullIllegalArgumentException - if the unit cannot be convertedpublic static long[] convertAmount(long amount,
TemporalUnit fromUnit,
TemporalUnit toUnit)
This works on the units in ChronoUnit and IsoFields.
The DAYS and WEEKS units are handled as exact multiple of 24 hours.
The ERAS and FOREVER units are not supported.
amount - the input amount in terms of the fromUnitfromUnit - the unit to convert from, not nulltoUnit - the unit to convert to, not nullDateTimeException - if the units cannot be convertedUnsupportedTemporalTypeException - if the units are not supportedArithmeticException - if numeric overflow occursCopyright © 2010–2016 ThreeTen.org. All rights reserved.