Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

TimezoneID for Amarillo, Texas

ziggy25Apr 23 2009 — edited Apr 23 2009
Hi,

Could someon please let me know how i can find out the java timezoneid for Amarillo?

I've written this piece of code to get all the timezone id but it doesnt return anything for Amarillo (US)
import java.util.TimeZone; 
import java.util.Date; 

public class TimeZones { 
  public static void main(String[] a) { 
     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); 

System.out.println("==========================================================");
System.out.println("TimezoneID = " + tz.getID());
System.out.println("DisplayName = " + tz.getDisplayName());
System.out.println("DisplayName SHORT = " + tz.getDisplayName(tz.inDaylightTime(today), TimeZone.SHORT));

System.out.println("DisplayName LONG = " + tz.getDisplayName(tz.inDaylightTime(today), TimeZone.LONG));

System.out.println("Timezone = " + tz.getTimeZone(zoneIds[i]));
System.out.println("Has Daylight saving time period = " + tz.useDaylightTime());
System.out.println("In Daylight savings time = " + tz.inDaylightTime(today));

}

}
}



And also, if i use a timezone, for example Europe/London, would i have to update my program every time the clock changes in the UK (e.g. to British summer time)?

Thanks

ps. Question also posted in another forum.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 21 2009
Added on Apr 23 2009
7 comments
357 views