package nameyu;import java.util.Scanner;public class Test { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Scanner input=new Scanner(System.in); System.out.print("Enter the time zone offset to GMT :"); int GMT =input.nextInt(); long totalMilliseconds=System.currentTimeMillis(); long totalSeconds=totalMilliseconds/1000; long currentSecond=totalSeconds%60; long totalMinutes=totalSeconds/60; long currentMinutes=totalSeconds%60; long totalHours=totalMinutes/60; long currentHours=totalHours%24; System.out.println("Current time is"+(currentHours+GMT)+":"+currentMinutes+":"+currentSecond); }
|