//there is my codes
public static void main(String[] args) {
String a = "19900416000000";
String b = "19900415000000";
DateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
df.setLenient(false);
try {
df.parse(a);
} catch (ParseException e) {
System.out.println("a parse error");
e.printStackTrace();
}
try {
df.parse(b);
}catch (ParseException e){
System.out.println("b parse error");
e.printStackTrace();
}
// and I get an error,like this
b parse error
java.text.ParseException: Unparseable date: "19900415000000"
at java.text.DateFormat.parse(DateFormat.java:366)
at org.suanhua.elasticsearch.client.ETLTest.main(ETLTest.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
So,what's the different between a and b? why parse(b) get an error?
//there is my import
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
// use jdk8 under intellij