in Java, how to parse a date string that contains a letter that does not represent a pattern?
"2007-11-02T14:46:03+01:00"
String date ="2007-11-02T14:46:03+01:00";
String format = "yyyy-MM-ddTHH:mm:ssz";
new SimpleDateFormat(format).parse(date);
Exception in thread "main" java.lang.IllegalArgumentException: Illegal pattern character 'T'
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:769)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:576)
at java.text.SimpleDateFormat.(SimpleDateFormat.java:501)
at java.text.SimpleDateFormat.(SimpleDateFormat.java:476)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…