import java.util.*; import java.text.*; import GMTZone; public class ExtDateFormat extends SimpleDateFormat { public ExtDateFormat( int dtDisplay, int tmDisplay, Locale loc ) { SimpleDateFormat temp = (SimpleDateFormat) DateFormat.getDateTimeInstance( dtDisplay, tmDisplay, loc ); String pat = temp.toLocalizedPattern(); applyLocalizedPattern( pat ); } public String format( Date date, TimeZone tz ) { setTimeZone( tz ); return format( date ); } public static void main(String[] args) { Locale loc = args.length == 2 ? new Locale( args[0], args[1] ) : Locale.getDefault(); Locale.setDefault( loc ); String pad = " "; // 20 spaces Date now = new Date(); TimeZone tz; ExtDateFormat edf = new ExtDateFormat( DateFormat.DEFAULT, DateFormat.LONG, loc ); // String[] zoneIDs = TimeZone.getAvailableIDs(); String[] zoneIDs = GMTZone.getAvailableIDs(); System.out.println("Zone ID Current Date and Time"); System.out.println("------- ----------------------------------"); for( int i=0; i< zoneIDs.length; i++ ) { // tz = TimeZone.getTimeZone( zoneIDs[i] ); tz = GMTZone.getTimeZone( zoneIDs[i] ); int offset = Math.max( 1, 18 - zoneIDs[i].length() ); System.out.println(" " + zoneIDs[i] + pad.substring( 0, offset ) + edf.format( now, tz ) ); } } }