List of utility methods to do Instant Calculate
Instant | plus(Instant instant, Duration add) plus if (isInfFuture(instant)) { return INF_FUTURE; } else if (isInfPast(instant)) { return INF_PAST; } else if (isInfPositive(add)) { return INF_FUTURE; } else if (isInfNegative(add)) { return INF_PAST; ... |
Instant | plusMilli(Instant _date, long _milli) Add _milli milliseconds to _date return _date.plus(_milli, ChronoField.MILLI_OF_DAY.getBaseUnit());
|
Instant | restrictToDaytime(Instant instantToRestrict, Instant thresholdTime, ZoneId userZoneId) restrict To Daytime ZonedDateTime zonedDateTime = instantToRestrict.atZone(userZoneId); if (zonedDateTime.getHour() <= earliestHourForAutomatedMessage) { zonedDateTime = ZonedDateTime.of(zonedDateTime.toLocalDate(), earliestHour, userZoneId); return thresholdTime == null || zonedDateTime.toInstant().isBefore(thresholdTime) ? zonedDateTime.toInstant() : thresholdTime; } else if (zonedDateTime.getHour() >= latestHourForAutomatedMessages) { zonedDateTime = ZonedDateTime.of(zonedDateTime.toLocalDate(), latestHour, userZoneId); ... |
Instant | roundUp(final Instant time, final Duration duration) Round time to next multiple of given duration return roundUp(time, duration.getSeconds());
|
long | secondsAgo(Instant end) seconds Ago return Duration.between(Instant.EPOCH, end).getSeconds();
|