yyyy/mm/dd hh:mm:ss を出力する関数があります。6 時間進んでいるように見える時間を除いて、すべてが完全に正確です。理由についてのアイデアはありますか?
public static void dateAndTime() {
Calendar cal = Calendar.getInstance();
int month = cal.get(Calendar.MONTH)+1;
int day = cal.get(Calendar.DATE);
int year = cal.get(Calendar.YEAR);
long totalMilliseconds = System.currentTimeMillis();
long totalSeconds = totalMilliseconds / 1000;
int currentSecond = (int)(totalSeconds % 60);
long totalMinutes = totalSeconds / 60;
int currentMinute = (int)(totalMinutes % 60);
long totalHours = totalMinutes / 60;
int currentHour = (int)(totalHours % 24);
System.out.println (year + "-" + month + "-" + day + " " + currentHour + ":" + currentMinute + ":" + currentSecond);
}