-1
공용 클래스 ShowCurrentTimesystem.currentTimeMillis()를 사용하여 시간대의 현재 시간을 추출하는 방법은 무엇입니까?
{
공공 정적 무효 메인 (문자열 []에 args)
{
// Obtain the total milliseconds
long totalMilliseconds = System.currentTimeMillis();
// Obtain the total seconds
long totalSeconds = totalMilliseconds/1000;
// Compute the current second in the minute in the hour
long currentSecond = totalSeconds % 60;
// Obtain the total minutes
long totalMinutes = totalSeconds/60;
// Compute the current minute in the hour
long currentMinute = (totalMinutes % 60);
// Obtain the total hours
long totalHours = totalMinutes/60;
// Compute the current hour
long currentHour = totalHours % 24;
// Display results
System.out.println("Current time is " + currentHour + ":" + currentMinute + ":" + currentSecond + "GMT");
}
}
이 코드를 실행, 그리니치 표준시가 부여하는 방법을 구성합니다 GMT +5 : 30 (IST)와 같은 특정 시간대의 현재 시간을 얻으려고합니까?