Modifier and Type | Field and Description |
---|---|
static Duration |
ONE_SECOND
A duration of one second.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
equals(Duration lhs,
Duration rhs,
Duration threshold)
Checks whether two durations are equal to within the given threshold.
|
static LocalTime |
plusNoWrapAround(LocalTime time,
Duration amountToAdd)
Adds the given duration to the given local time, without wrap around.
|
static LocalTime |
plusNullOnWrapAround(LocalTime time,
Duration amountToAdd)
Adds the given duration to the given local time, without wrap around.
|
static ZonedDateTime |
plusNullOnWrapAround(ZonedDateTime dateTime,
Duration amountToAdd)
Same specification as
plusNoWrapAround(LocalTime, Duration) , but with zoned date times instead. |
static DayOfWeek |
toDayOfWeek(Instant instant,
ZoneId targetZone) |
static Instant |
toInstant(LocalDate sourceDate,
LocalTime sourceTime,
ZoneId sourceZone)
Converts the date time from the source time zone to an instant.
|
static Instant |
toInstant(LocalDateTime sourceDateTime,
ZoneId sourceZone)
Converts the date time from the source time zone to an instant.
|
static LocalDateTime |
toLocalDateTime(Instant instant,
ZoneId targetZone)
Converts an instant to a local date time in a given time zone.
|
static LocalDateTime |
toLocalDateTime(LocalDate sourceDate,
LocalTime sourceTime,
ZoneId sourceZone,
ZoneId targetZone)
Converts the date time from the source time zone to the target time zone.
|
static LocalDateTime |
toLocalDateTime(LocalDateTime sourceDateTime,
ZoneId sourceZone,
ZoneId targetZone)
Converts the date time from the source time zone to the target time zone.
|
static ZonedDateTime |
toZonedDateTime(Instant instant,
ZoneId targetZone)
Converts an instant to a zoned date time in a given time zone.
|
static ZonedDateTime |
toZonedDateTime(LocalDate sourceDate,
LocalTime sourceTime,
ZoneId sourceZone,
ZoneId targetZone)
Converts the date time from the source time zone to the target time zone.
|
static ZonedDateTime |
toZonedDateTime(ZonedDateTime sourceDateTime,
ZoneId targetZone)
Converts the date time from the source time zone to the target time zone.
|
public static final Duration ONE_SECOND
public static boolean equals(Duration lhs, Duration rhs, Duration threshold)
lhs
- First duration to compare. null
is considered Duration.ZERO
.rhs
- Second duration to compare. null
is considered Duration.ZERO
.threshold
- Threshold for the comparison.true
if |rhs-lhs| <= threshold
, or false
otherwise.public static LocalTime plusNoWrapAround(LocalTime time, Duration amountToAdd)
LocalTime.MAX
)LocalTime.MAX
)time
- Time to which to add an amount.amountToAdd
- Amount to add.00:00
and 23:59
.public static LocalTime plusNullOnWrapAround(LocalTime time, Duration amountToAdd)
LocalTime.MAX
time
- Time to which to add an amount.amountToAdd
- Amount to add.00:00
and 23:59
.public static ZonedDateTime plusNullOnWrapAround(ZonedDateTime dateTime, Duration amountToAdd)
plusNoWrapAround(LocalTime, Duration)
, but with zoned date times instead.dateTime
- Time to which to add an amount.amountToAdd
- Amount to add.00:00
and 23:59
.public static DayOfWeek toDayOfWeek(Instant instant, ZoneId targetZone)
instant
- An instant for which to get the day of week.targetZone
- Target time zone in which to get the day of week.public static Instant toInstant(LocalDate sourceDate, LocalTime sourceTime, ZoneId sourceZone)
sourceDate
- Date to convert.sourceTime
- Time to convert.sourceZone
- Source time zone.public static Instant toInstant(LocalDateTime sourceDateTime, ZoneId sourceZone)
sourceDateTime
- Date time to convert.sourceZone
- Source time zone.public static LocalDateTime toLocalDateTime(Instant instant, ZoneId targetZone)
instant
- An instant to convert.targetZone
- Target time zone.public static ZonedDateTime toZonedDateTime(Instant instant, ZoneId targetZone)
instant
- An instant to convert.targetZone
- Target time zone.public static LocalDateTime toLocalDateTime(LocalDate sourceDate, LocalTime sourceTime, ZoneId sourceZone, ZoneId targetZone)
sourceDate
- Date to convert.sourceTime
- Time to convert.sourceZone
- Source time zone.targetZone
- Target time zone.public static ZonedDateTime toZonedDateTime(LocalDate sourceDate, LocalTime sourceTime, ZoneId sourceZone, ZoneId targetZone)
sourceDate
- Date to convert.sourceTime
- Time to convert.sourceZone
- Source time zone.targetZone
- Target time zone.public static ZonedDateTime toZonedDateTime(ZonedDateTime sourceDateTime, ZoneId targetZone)
sourceDateTime
- Source date time to convert.targetZone
- Target time zone.public static LocalDateTime toLocalDateTime(LocalDateTime sourceDateTime, ZoneId sourceZone, ZoneId targetZone)
sourceDateTime
- Date time to convert.sourceZone
- Source time zone.targetZone
- Target time zone.Copyright © 2020 XIMA MEDIA GmbH. All rights reserved.