java.text.ParseException:无法解析的日期 [英] java.text.ParseException: Unparseable date
本文介绍了java.text.ParseException:无法解析的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到以下错误:
'java.text.ParseException:无法解析的日期:8月31日9时53分19秒2011'这种格式:新的SimpleDateFormat(MMM DD HH:MM:SS YYYY);
I get the following error:
´java.text.ParseException: Unparseable date: "Aug 31 09:53:19 2011"´ with this format: new SimpleDateFormat("MMM dd HH:mm:ss yyyy");
有没有人看到这个问题?
Does anyone see the problem?
推荐答案
请确保你使用正确的语言环境。 (该的SimpleDateFormat(字符串)
构造函数使用的系统默认区域设置,这可能不是你想要使用的。)
Make sure you're using the correct locale. (The SimpleDateFormat(String)
constructor uses the system default locale, which may not be the one you want to use.)
这工作正常,我的机器上:
This works fine on my machine:
String input = "Aug 31 09:53:19 2011";
DateFormat df = new SimpleDateFormat("MMM dd HH:mm:ss yyyy", Locale.US);
System.out.println(df.parseObject(input));
(当使用 Locale.FRENCH
例如,导致 ParseException的
)
这篇关于java.text.ParseException:无法解析的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文