In the output section below, the "Hours in-between" displayed is zero. The result expected is a non-zero value.
The Java code:
ZonedDateTime zdt1 = ZonedDateTime.now(ZoneId.of("Asia/Calcutta"));
ZonedDateTime zdt2 = ZonedDateTime.now(ZoneId.of("America/Toronto"));
Duration duration2 = Duration.between(zdt1, zdt2);
System.out.format("ZonedDateTime 1 %s\n", zdt1);
System.out.format("ZonedDateTime 2 %s\n", zdt2);
System.out.format("Hours in between %d\n", duration2.toHours());
The output:
ZonedDateTime 1 2021-11-10T16:44:38.237844+05:30[Asia/Calcutta]
ZonedDateTime 2 2021-11-10T06:14:38.239340-05:00[America/Toronto]
Hours in between 0