Java Utililty Methods Instant Calculate

List of utility methods to do Instant Calculate

Description

The list of methods to do Instant Calculate are organized into topic(s).

Method

longconvertInstantToDotNetTicks(Instant instant)
convert Instant To Dot Net Ticks
return (instant.getEpochSecond() * 10000000) + (instant.getNano() / 100) + EPOCHINDOTNETTICKS;
ZonedDateTimeconvertToUserTimeZone(Instant timeInSystem, ZoneId userZoneId)
convert To User Time Zone
return timeInSystem.atZone(userZoneId);
DatedateOf(final Instant time)
Gets Date for Instant.
return Date.from(time);
InstantepochToInstant(long epochMilliSecond)
epoch To Instant
return Instant.ofEpochMilli(epochMilliSecond);
FilegetNquadsFile(final File dir, final Instant time)
Get the nquads file for a given moment in time.
return new File(dir, Long.toString(time.getEpochSecond()) + ".nq");
InstantgetPeriodInstant(LocalDate localDate)
get Period Instant
LocalDateTime localDateTime = localDate.atStartOfDay();
return localDateTime.toInstant(ZoneOffset.UTC);
longgetSnowflakeFromTimestamp(Instant date)
Gets a snowflake from a unix timestamp.
return (date.toEpochMilli() - DISCORD_EPOCH) << 22;
booleanisEqualOrAfterNow(Instant now, Instant instant)
is Equal Or After Now
return !instant.isBefore(now);
InstantmaxInstant(Instant v1, Instant v2)
max Instant
if (v1 == null) {
    throw new IllegalArgumentException("Instant v1 is null");
} else if (v2 == null) {
    throw new IllegalArgumentException("Instant v2 is null");
return v1.isAfter(v2) ? v1 : v2;
longnanos(Instant instant)
nanos
return instant.getEpochSecond() * 1000_000_000L + instant.getNano();