Date today = new Date();

// Get all time zone ids
String[] zoneIds = TimeZone.getAvailableIDs();

// View every time zone
for (int i=0; i<zoneIds.length; i++) {
     // Get time zone by time zone id
     TimeZone tz = TimeZone.getTimeZone(zoneIds[i]);

     // Get the display name
     String shortName = tz.getDisplayName(tz.inDaylightTime(today), 
TimeZone.SHORT);
     String longName = tz.getDisplayName(tz.inDaylightTime(today), 
TimeZone.LONG);

     // Get the number of hours from GMT
     int rawOffset = tz.getRawOffset();
     int hour = rawOffset / (60*60*1000);
     int min = Math.abs(rawOffset / (60*1000)) % 60;

     // Does the time zone have a daylight savings time period?
     boolean hasDST = tz.useDaylightTime();

     // Is the time zone currently in a daylight savings time?
     boolean inDST = tz.inDaylightTime(today);
}



On 4/14/2011 3:34 PM, Matthew Adams wrote:
> Hi all,
>
> Are there enums of the long string ids of timezones somewhere?  Like
> "America/Los_Angeles"?  I know we're supposed to use those, but where
> are they defined?  RTFMs are welcome for this question.
>
> Thanks,
> Matthew
>

------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Joda-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to