Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何输出“GMT -0X:00”(X - 一个数字)”?
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() );