Name: mf23781 Date: 10/28/97
Many strange effects noticed
Timezones not recognized (e.g. CET).
If TimeZone recognized then SimpleDateFormat displays it as
an offset from GMT (e.g. PST displayed as GMT-08:00)
GMT offset are not recognized (e.g. GMT-08:00)
Test Program :
import java.util.*;
import java.text.*;
public class TestTime {
public static void printTime (String tz) {
TimeZone t = TimeZone.getTimeZone(tz);
if (t != null) {
GregorianCalendar testDate =
new GregorianCalendar(t);
SimpleDateFormat d = new SimpleDateFormat("HH:mm:ss zzzz");
d.setTimeZone (t);
System.out.println (tz + " - Date = "
+ d.format(testDate.getTime()));
}
else
System.out.println (tz + " - No TimeZone");
}
public static void main (String[] args) {
printTime ("GMT");
printTime ("CET");
printTime ("PST");
printTime ("GMT-08:00");
}
}
Produces the following results
$ java TestTime
GMT - Date = 16:09:12 Greenwich Mean Time
CET - No TimeZone
PST - Date = 08:09:13 GMT-08:00
GMT-08:00 - No TimeZone
======================================================================