Skip to content

Instantly share code, notes, and snippets.

@ravibharathii
Created February 3, 2019 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ravibharathii/3e1ed8e53025219a4b47268d3aee26ea to your computer and use it in GitHub Desktop.
Save ravibharathii/3e1ed8e53025219a4b47268d3aee26ea to your computer and use it in GitHub Desktop.
LocalTime midnight = LocalTime.MIDNIGHT;
System.out.println(midnight);
LocalDate today = LocalDate.now(ZoneId.of("UTC"));
System.out.println(today);
LocalDateTime todayMidnight = LocalDateTime.of(today, midnight);
System.out.println(todayMidnight);
ZonedDateTime todyzdt = todayMidnight.atZone(ZoneId.of("UTC"));
System.out.println(todyzdt);
long todaymillis = todyzdt.toInstant().toEpochMilli();
System.out.println(todaymillis);
LocalTime midnight1 = LocalTime.MIDNIGHT;
LocalDate today1 = LocalDate.now(ZoneId.of("UTC"));
LocalDateTime todayMidnight1 = LocalDateTime.of(today1, midnight1);
LocalDateTime tomorrowMidnight1 = todayMidnight1.plusDays(1);
ZonedDateTime todyzdt1 = todayMidnight1.atZone(ZoneId.of("UTC"));
long todaymillis1 = todyzdt1.toInstant().toEpochMilli();
ZonedDateTime tomorrowzdt1 = tomorrowMidnight1.atZone(ZoneId.of("UTC"));
long tomorrowmillis = tomorrowzdt1.toInstant().toEpochMilli();
System.out.println(tomorrowmillis);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment