Why is the minus sign present in the output?

Viewed 106

I have the following lines of code:

LocalDateTime ldt = LocalDateTime.of(2017, 06, 02, 6, 0, 0);
ZoneOffset nyOffset = ZoneOffset.ofHoursMinutes(-5, 0);        
ZoneId nyZone = ZoneId.of("America/New_York");
OffsetDateTime nyOdt = ldt.atOffset(nyOffset);
ZonedDateTime nyZdt = ldt.atZone(nyZone);
Duration d = Duration.between(nyOdt, nyZdt);
System.out.println(d);

The output is PT-1H. Why is this happening? nyZdt is not before nyOdt. Am I wrong?

1 Answers
Related