SimpleDateFormat sdf = new SimpleDateFormat("E MMM dd HH:mm:ss yyyy", Locale.ENGLISH);
Date d = sdf.parse("Wed Jan 03 00:00:00 1900");
System.out.println(new SimpleDateFormat("yyyy-MM-dd").format(d));
好把在中文状态下一定要确定Locale.ENGLISH,否为不识别为英文LOCAL。
报如下错误
Exception in thread "main" java.text.ParseException: Unparseable date: "Dec"
at java.text.DateFormat.parse(DateFormat.java:337)