List of utility methods to do ZonedDateTime Calculate
ZonedDateTime | timestampToZonedDateTime(Long timestamp) timestamp To Zoned Date Time return Instant.ofEpochSecond(timestamp).atZone(ZoneOffset.UTC);
|
long | toEpochMillSeconds(ZonedDateTime time) to Epoch Mill Seconds long seconds; if (time != null) seconds = time.toEpochSecond(); else seconds = 0; return seconds; |
long | toEpochTime(ZonedDateTime input) to Epoch Time if (input == null) { throw new IllegalArgumentException("Input time must not be null"); return input.toEpochSecond(); |
String | toLocalDateString(ZonedDateTime zonedDateTime) Converts a LocalDateTime to a UTC ISO_8601 string representation e.g. return zonedDateTime.withZoneSameInstant(ZoneOffset.UTC).toLocalDate().format(localDateFormatter);
|
Optional | toUTCZonedDateTime(String dateString) Converts any valid ZonedDateTime String (ISO_8601) representation to a UTC ZonedDateTime e.g. try { ZonedDateTime utcDateTime = ZonedDateTime.parse(dateString, dateTimeFormatterAny) .withZoneSameInstant(UTC); return Optional.of(utcDateTime); } catch (DateTimeParseException ex) { return Optional.empty(); |
ZonedDateTime | toZeroMSN(ZonedDateTime dateTime) to Zero MSN return dateTime.withMinute(0).withSecond(0).withNano(0);
|
long | uaDateTimeFromTime(ZonedDateTime time) ua Date Time From Time Instant i = Instant.from(time); long seconds = i.getEpochSecond(); int nanoOfSecond = i.getNano(); long value = (UNIX_EPOCH_BIAS_SEC + seconds) * 10000000L + nanoOfSecond / 100L; return value; |
ZonedDateTime | Youngest(ZonedDateTime ZDT1, ZonedDateTime ZDT2) Youngest return ZDT1 == null ? ZDT2 : ZDT2 == null ? ZDT1 : ZDT1.compareTo(ZDT2) > 0 ? ZDT1 : ZDT2;
|
long | zoneDateTime2long(final ZonedDateTime zdt) convert ZonedDateTime to millisecond(long). return zdt.toInstant().toEpochMilli();
|