First get all the Ids by
tring ids[]= TimeZone.getAvailableIDs(); for(int i=0;i<0;i++){ // will give you the TimeZone offsets such as +5,-4 etc. TimeZone.getTimeZone(ids[i]).getRawOffset(); } // will return the timeZone offset set in the device. TimeZone.getDefault().getRawOffset();
TimeZone class is applicable for both Blackberry and J2ME
From Blackberry 4.6 a new class TimeZoneUtilities is intoduced.
Just use the following code to retrieve array of Timezones
String str[]=TimeZoneUtilities.getDisplayNames(0);
The above code will give the list of important places and their corresponding timezones where as TimeZone class willl give only TimeZones (without city name).
Using the getRowOffset, how do you compensate for day-light-savings-time?
ReplyDeleteAlso, getRowOffset does not return -4 or +5 but rather the actual milliseconds that you then have to convert (no biggy but thought that it should be pointed out).
Daylight saving is not static i.e Daylight saving changes from year to year.In that case its better to get daylight from web services.
ReplyDeleteTimeZone.getDefault().getRawOffset() will return the timezone rather than time in millis....