Vignesh Thillai
Vignesh Thillai

Reputation: 91

Android missing some timezones that are available in Java

In Android

Timezone.getAvailableIds();

returns only 580 ids.

In Java (both are same version 1.7)

Timezone.getAvailableIds()

returns 623 ids.

Some of the missing IDs are

IST

PST

ECT

JST

Any help on this?

Upvotes: 0

Views: 273

Answers (1)

Sergey Emeliyanov
Sergey Emeliyanov

Reputation: 6961

For compatibility with JDK 1.1.x, some other three-letter time zone IDs (such as "PST", "CTT", "AST") are also supported.

Notice the word "some", meaning that in Android not all three-letter time zone IDs are supported. This is why you get only 580 IDs instead of 623. The supported time zone IDs would depend on the SDK version you're using.

Also, note that this way of representation is deprecated:

However, their use is deprecated because the same abbreviation is often used for multiple time zones (for example, "CST" could be U.S. "Central Standard Time" and "China Standard Time"), and the Java platform can then only recognize one of them.

Reference: https://developer.android.com/reference/java/util/TimeZone.html

I hope this answers your question.

Upvotes: 1

Related Questions