Java Data Type How to - Get the time different between two timezones


We would like to know how to get the time different between two timezones.


import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.temporal.ChronoUnit;
import java.util.TimeZone;
public class Main {
  public static void main(String[] argv) {
    ZoneId INDIA = ZoneId.of("Asia/Kolkata");
    //  w ww  .  j  a v a  2 s.  c  om
    LocalDateTime utah =;
    LocalDateTime india =;
    long betweenHours = ChronoUnit.HOURS.between(utah, india);
    long betweenMins = ChronoUnit.MINUTES.between(utah, india);
    System.out.println("betweenHours = " + betweenHours);
    System.out.println("betweenMins = " + (betweenMins/60.0));

The code above generates the following result.