List of utility methods to do Instant Create
Instant | convertDotNetTicksToInstant(long dotNetTicks) convert Dot Net Ticks To Instant long ticksFromEpoch = dotNetTicks - EPOCHINDOTNETTICKS; long millisecondsFromEpoch = ticksFromEpoch / 10000; long fractionTicks = ticksFromEpoch % 10000; return Instant.ofEpochMilli(millisecondsFromEpoch).plusNanos(fractionTicks * 100); |
Instant | deserializeToInstant(String date) deserialize To Instant return Instant.parse(date);
|
Instant | deserializeToInstant(String date) deserialize To Instant return deserialize(date).toInstant(ZoneOffset.UTC);
|
Duration | end(String msg, long amount, Instant start) end Duration d = Duration.between(start, Instant.now()); System.out.println("PerformanceTest: " + msg); System.out.println("Total time needed: " + d.toMillis() / 1000d + " seconds for " + amount + " iterations"); System.out.println("That's " + d.toNanos() / (double) amount + "nanos per iteration"); return d; |
Instant | getEarliestInstant() get Earliest Instant return earliestInstant;
|
Instant | getInstant(final Calendar calendar) Get an instant from a calendar return calendar.toInstant();
|
Instant | getInstant(LocalDate localDate) get Instant return localDate.atStartOfDay().atZone(DEFAULT_ZONE_ID).toInstant();
|
Instant | getInstantOfEpoch(long seconds) gibt ein Instant zum Zeitstempel zurueck return Instant.ofEpochSecond(seconds, 0);
|
Instant | getThisMonthBeginInstant() get This Month Begin Instant LocalDateTime localDate = LocalDateTime.now().withSecond(0).withHour(0).withMinute(0)
.with(TemporalAdjusters.firstDayOfMonth()).truncatedTo(ChronoUnit.SECONDS);
return localDate.toInstant(ZoneOffset.UTC);
|
Instant | instant(int _y, int _m, int _d, int _H, int _M, int _S) Get an Instant from local parameters: year, month, day, hour, minutes, seconds return LocalDateTime.of(_y, _m, _d, _H, _M, _S).toInstant(localZoneOffset);
|