1

I need to show the device current time zone in short form. (For ex: IST for India Standard Time).

Below method returns full name of time zone. (i.e India Standard Time)

public static String getTimeZoneShortName() {
    return Calendar.getInstance().getTimeZone().getDisplayName();
}

Below method gives the timezone in short form if I use it in a Java program. But it gives the output as "GMT+5:30" on Android.

public static String getTimeZoneShortName() {
    return Calendar.getInstance().getTimeZone().getDisplayName(false, TimeZone.SHORT);
}

I need to show only the short form of the zone. How do I do it in Android?

Anu
  • 165
  • 10
  • I found this, hope it helps: http://stackoverflow.com/questions/15068113/how-to-get-the-timezone-offset-in-gmtlike-gmt700-from-android-device

    – tom1988 Oct 17 '16 at 11:08
  • @tom1988 I think the OP wants the opposite of what was asked in the link you had shown, namely short name instead of gmt offset. – Meno Hochschild Oct 17 '16 at 11:44

0 Answers0