The problem with these 3 letter abbreviations is that they are ambiguous, not standard .
, MST - , , DST ( DST, , - DST , ).
API (java.util.TimeZone) , , MST America/Denver, joda-time - IMO - ( - jodatime 2.7). , :
map.put("MST", "America/Denver");
DateTimeZone.forTimeZone(TimeZone), TimeZone jodatime DateTimeZone ( ).
, , , @Ole V.V. America/Phoenix MST. , .
(Continent/City) IANA database , Java API Joda.
:
DateTime utc = new DateTime("2017-03-26T10:00:00Z", DateTimeZone.UTC);
System.out.println(utc);
DateTimeZone arizona = DateTimeZone.forID("America/Phoenix");
DateTime arizonaDate = utc.withZone(arizona);
System.out.println(arizonaDate);
API Java Time
, API Date/Time ( Joda- API , , , ).
joda , joda website : , Joda-Time "" , . Java SE 8, java.time(JSR-310).
Java 8, API java.time. , , API.
Java <= 7, ThreeTen Backport, backport Java 8 . Android ThreeTenABP ( , ).
.
- ( Java 8 - java.time, ThreeTen Backport ( Android ThreeTenABP) - org.threeten.bp), .
API MST , Map:
Map<String, String> map = new HashMap<>();
map.put("MST", "America/Phoenix");
ZoneId arizona = ZoneId.of("MST", map);
ZonedDateTime utc = ZonedDateTime.parse("2017-03-26T10:00:00Z");
System.out.println(utc);
ZonedDateTime arizonaDate = utc.withZoneSameInstant(arizona);
System.out.println(arizonaDate);
, ZoneId.of("America/Phoenix"), MST, .
, API []. , DateTimeFormatter. ( javadoc ) :
DateTimeFormatter fmt = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
System.out.println(fmt.format(arizonaDate));
fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
System.out.println(fmt.format(arizonaDate));