java - Is TimeZone.setTimeZone("est") different from TimeZone.setTimeZone("EST") - Stack Overflow
In short, yes it is case sensitive.
Following your examples ist
gives you GMT
because a timezone with such an ID can't be find, thus giving you default result
it works with est
(GMT-05:00
is EASTERN STANDARD TIME
), surely because both IDs are known, but I wouldn't count on it (not too sure it would still be there if change platform).
Furthermore, as told by the API you shouldn't use those abbreviated IDs but directly full name or custom ID.
You can have a list of your platform's available IDs using TimeZone.getAvailableIDs()
, then you can pick the right one.
I would myself consider using GMT-5:00
format, which is in my opinion more readable and less error prone.
Read full article from java - Is TimeZone.setTimeZone("est") different from TimeZone.setTimeZone("EST") - Stack Overflow
No comments:
Post a Comment