Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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");

        LocalDateTime utah = LocalDateTime.now();
        LocalDateTime india = LocalDateTime.now(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));
    }
}