I can\'t understand why this few lines
Date submissionT;
SimpleDateFormat tempDate = new SimpleDateFormat(\"EEE MMM d HH:mm:ss z yyyy\");
public
The 'z' in your format represents TimeZone and Java only recognises certain timezone ID's. You can get the list out of the TimeZone class as a String Array. CEST does not appear in the list I just generated from JDK 1.5
String[] aZones = TimeZone.getAvailableIDs();
for (int i = 0; i < aZones.length; i++) {
String string = aZones[i];
System.out.println(string);
}
Hope this helps.
Works for me.
public class Main {
public static void main(String[] args)
{
time_print("Tue Mar 31 06:09:00 CEST 2009");
}
static Date submissionT;
static SimpleDateFormat tempDate = new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy");
public static void time_print(String time) {
try {
submissionT=tempDate.parse(time);
System.out.println(submissionT);
}
catch (Exception e) {
System.out.println(e.toString() + ", " + time);
}
}
}
It is a Locale issue. Use:
sdf = SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy", Locale.US);