【发布时间】:2014-03-08 07:42:15
【问题描述】:
我想用SimpleDateFormat.parse方法来设置日期:
private static SimpleDateFormat fmt = new SimpleDateFormat("dd-MMM");
...
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
calendar.setTime(fmt.parse("9-Jul"));
calendar.set(Calendar.YEAR, year);
但我明白了:
Exception in thread "main" java.text.ParseException: Unparseable date: "9-Jul"
at java.text.DateFormat.parse(Unknown Source)
at BusinessPlan.main(BusinessPlan.java:116)
代码来自 Apache 示例站点,并以this bug 发布。
【问题讨论】:
标签: java date datetime apache-poi simpledateformat