このコードを書くとき:
Calendar cal = Calendar.getInstance();
cal.setTimeZone(TimeZone.getTimeZone("EST"));
System.out.println(cal.getTimeZone().getDisplayName());
出力は
Eastern Standard Time
しかし、このコードを書くと:
Calendar cal = Calendar.getInstance();
cal.setTimeZone(TimeZone.getTimeZone("est"));
System.out.println(cal.getTimeZone().getDisplayName());
私が得る出力は次のとおりです。
GMT-05:00
設定時に「EST」や「est」などの引数を与えることに違いはありますかTimeZone.setTimeZone(String str)
(str
CASE SENSITIVEと見なされる呼び出し時に渡されます)?
APIはそれについて何も言及していません:
getTimeZone
public static TimeZone getTimeZone(String ID)
Gets the TimeZone for the given ID.
Parameters:
ID - the ID for a TimeZone, either an abbreviation such as "PST", a full name such as "America/Los_Angeles", or a custom ID such as "GMT-8:00".
Note that the support of abbreviations is for JDK 1.1.x compatibility only and full names should be used.
Returns:
the specified TimeZone, or the GMT zone if the given ID cannot be understood.
IST
注:と文字列を試しましist
た。それIST
が与える文字列とIndian Standard Time
それist
が与えるものGreenwich Mean Time