package test; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.TimeZone; public class TimezoneTest { int ii = 0; public TimezoneTest() {} public void test1() { System.out.println("version="+System.getProperty("java.version")); System.out.println("vendor="+System.getProperty("java.vendor")); System.out.println("java.vm.specification.version="+System.getProperty("java.vm.specification.version")); System.out.println("java.vm.specification.vendor="+System.getProperty("java.vm.specification.vendor")); System.out.println("java.vm.version="+System.getProperty("java.vm.version")); System.out.println("java.vm.vendor="+System.getProperty("java.vm.vendor")); Calendar cal = Calendar.getInstance(); System.out.println(Calendar.ERA); TimeZone tz = TimeZone.getDefault(); tz.setID("America/Chicago"); System.out.println("timezone.id="+tz.getID()); for( int ii = 1899; ii < 1904; ii++) { cal.set(ii, Calendar.JANUARY, 1, 0, 0, 0); cal.set(Calendar.MILLISECOND, 0); System.out.println("date="+cal.getTime()); for( int jj = 0;jj<12;jj++) { System.out.println(ii+"/"+jj+":"+tz.getOffset(GregorianCalendar.AD, ii, jj, 1, 1, 1)); } } } public void test2() { Calendar cal = Calendar.getInstance(); TimeZone tz = TimeZone.getDefault(); tz.setID("America/Chicago"); cal.set(1900, Calendar.JANUARY,1,0,0,0); System.out.println("January, 1900 timezone offset:"+tz.getOffset(GregorianCalendar.AD, 1900,0, 1, 1, 1)); } public static void main(String[] args) { try { TimezoneTest t = new TimezoneTest(); t.test2(); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } } }