JAVA显示当前时间

GMT显示当前时间
long totalMilliseconds = System.currentTimeMillis(); //1970年1月1日午夜到现在总毫秒数
long currentSecond = totalMilliseconds / 1000 % 60;
long currentMinute = totalMilliseconds / 1000 /60 % 60;
long currentHour = totalMilliseconds / 1000 /60 / 60 % 24;
System.out.println("Current time is" + currentHour + ":" + currentMinute + ":" + currentSecond + "GMT");




你可能感兴趣的:(JAVA显示当前时间)