这是我使用正则表达式提取信息的字符串:的Java字符串到日期不可分析日期
2823893a2f91c7507831f140dd7aa75e420477b0 - #0023922: Fixed the message for defaulted bonds ; Thu Oct 25 12:08:25 2012 +0000
这是我用来提取字符串,然后将代码试图使它成为一个日期:
Pattern pattern3 = Pattern.compile(";\\s(.*)");
Matcher matcher3 = pattern3.matcher(s);
matcher3.find();
String t = matcher3.group(1).toString();
try {
Date time = new SimpleDateFormat("dd/MMM/yy hh:mm a").parse(t);
} catch (ParseException e) {
e.printStackTrace();
}
这应该是我的输入格式:
Thu Oct 25 12:08:25 2012 +0000
而且我要的是使从一个日期上述字符串,它看起来像:
25/Oct/12 12:08 PM
但我不断收到这些错误:
java.text.ParseException: Unparseable date: "Thu Oct 25 12:08:25 2012 +0000"
Fixed the message for defaulted bonds0null
at java.text.DateFormat.parse(DateFormat.java:337)
at GitItem.cultivateGitItem(GitItem.java:42)
at main.main(main.java:9)
java.text.ParseException: Unparseable date: "Thu Oct 25 11:52:39 2012 +0000"
at java.text.DateFormat.parse(DateFormat.java:337)
at GitItem.cultivateGitItem(GitItem.java:42)
at main.main(main.java:9)
这看起来像VCS的输出......如果'git',为什么不使用jgit? (编辑:应阅读更多;它是混帐) – fge