I try to prove June 30th 2015 has 86401 seconds, use Java code like this:
Instant i1 = Instant.ofEpochSecond(longestDay.toEpochSecond(ZoneOffset.UTC));
Instant i2 = Instant.ofEpochSecond(oneDayAfter.toEpochSecond(ZoneOffset.UTC));
long d = i1.until(i2, ChronoUnit.SECONDS);
System.out.println(d);
// 86400
I try again:
LocalDateTime longestDay = LocalDateTime.of(2015, Month.JUNE, 30, 0, 0, 0);
LocalDateTime oneDayAfter = LocalDateTime.of(2015, Month.JULY, 1, 0, 0, 0, 0);
long p = ChronoUnit.SECONDS.between(longestDay, oneDayAfter);
System.out.println("p = " + String.valueOf(p));
// Result: p = 86400
still not success
I still try again:
ZonedDateTime startZdt = ZonedDateTime.of( 2015, 06, 30, 23, 59, 59, 00, ZoneOffset.UTC );
ZonedDateTime stopZdt = ZonedDateTime.of( 2015, 07, 01, 00, 00, 00, 00, ZoneOffset.UTC );
long elapsed = startZdt.until( stopZdt,ChronoUnit.SECONDS);
System.out.println("elapsed: " + elapsed);
// Result: elapsed: 1
I can't prove June 30th 2015 has 86401 seconds by Java code. Help me do this!
In Java, every day has the same number of seconds. In fact most operating systems don't support leap seconds, but treat it as drift. When you set to
UTC
you are actually setGMT+0