如何输出“GMT -0X:00”(X - 数字)“?
答案 0 :(得分:4)
Calendar cal = Calendar.getInstance(locale);
// or Calendar cal = Calendar.getInstance(timezone);
int zoneOffset = cal.get(Calendar.ZONE_OFFSET);
// eg: "-0700"
String timezoneStr = new SimpleDateFormat("Z").format( cal.getTime() );