这是我的代码,但在更改时区后得到相同的时间戳。
TimeZone timeZone = TimeZone.getTimeZone("GMT+11");
Calendar cal1 = Calendar.getInstance();
Calendar cal2 = Calendar.getInstance();
cal1.setTimeInMillis(Long.parseLong(classListDto.get(i)
.getClassStartTime()) * THOUSAND);
cal2.setTimeInMillis(Long.parseLong(classListDto.get(i)
.getClassEndTime()) * THOUSAND);
cal1.setTimeZone(timeZone);
cal2.setTimeZone(timeZone);
long startTimestamp = cal1.getTimeInMillis();
long endTimestamp = cal2.getTimeInMillis();