格式化时间遇到的问题SimpleDateFormat

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)

posted @ 2013-02-26 11:49  Jason-Holt  阅读(190)  评论(0编辑  收藏  举报