J2ME Get current timezone

I have a j2me application and it needs to get the name of the current timezone and send it to the server.

However, the only format I seem to be able to get to call me is "GMT-5: 00". What I want the application to do is return the timezone name (EST, PST, etc.).

I echoed the [] line returned by TimeZone.getAvailableIds () and it has a list of all the time zones in the format I want them to be. (EST, CST, "Pheonix, USA", "Europe / Samara, etc.)

Any ideas on how to get the timezone name instead of the offset from GMT + 0? Thanks in advance.

+2


source to share


2 answers


TimeZone.getID()

- this is what you are looking for; it should return one of the values ​​returned TimeZone.getAvailableIDs()

.



+1


source


you can create an array that will hold all of your timezone ids. then just add 12 to the timezone offset and you can use that as an index to call the timezone names from your array.



0


source







All Articles