宜昌市做网站,销量最高的wordpress模版,wordpress排除首页显示,静态网页制作技术我需要创建能够在GMT中找到当前小时并将其转换为EST的内容.当我尝试编译并运行程序时,我收到此错误#xff1a;currentHourEST无法解析为变量.我认为我的问题是if else语句中的某个地方,因为我将变量分配给了错误或其他东西.// Obtain total milliseconds since midnight, Jan…我需要创建能够在GMT中找到当前小时并将其转换为EST的内容.当我尝试编译并运行程序时,我收到此错误currentHourEST无法解析为变量.我认为我的问题是if else语句中的某个地方,因为我将变量分配给了错误或其他东西.// Obtain total milliseconds since midnight, Jan 1, 1970long totalMilliseconds System.currentTimeMillis();// Secondslong totalSeconds totalMilliseconds / 1000;long currentSecond totalSeconds % 60;// Minuteslong totalMinutes totalSeconds / 60;long currentMinute totalMinutes % 60;// Hourslong totalHours totalMinutes / 60;long currentHour totalHours % 24;// Read in EST offsetlong offSetAdded currentHour - 5;// If the time is negative make it a positiveif (offSetAdded 0) {long currentHourEST offSetAdded * -1;} else {long currentHourEST offSetAdded;}// Display timeSystem.out.println(The current time is currentHourEST : currentMinute : currentSecond);System.out.println(Current time in GMT is currentHour : currentMinute : currentSecond);我正在使用if else语句将offSetAdded乘以-1,以便小时,如果从我减去5时为负,则变为正数,使人们更容易看到小时.如果offSetAdded为正,那么它将打印当前正好减去5.