I use jodatime to parse date time strings as follows:
public static void main(String[]args){
String s ="16-Jul-2009 05:20:18 PDT";
String patterns = "dd-MMM-yyyy HH:mm:ss z";
DateTimeFormatter fm = DateTimeFormat.forPattern(patterns);
DateTime d=fm.parseDateTime(s);
System.out.println(d);
}
I get
Exception in thread "main" java.lang.IllegalArgumentException: Invalid format: "16-Jul-2009 05:20:18 PDT" is malformed at "PDT"
at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:683)
what's wrong? how to parse the timezone properly?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…