格式化时间遇到的问题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)
---------------------------------------------------------------------------------
Kind Regards,
HaiTao Niu
JavaScript developer :)
ORACLE Certified Database Administrator - 10g
SUN Certified Applocation Developer - Java 6
Ring Building,No.28,ZhongGuanCun Software Park, No.8 Dong Bei Wang West Road, Haidian District, Beijing P.R.China 100193
E-mail: 1648500@qq.com