java.text.ParseException: Unparseable date: “2015-03-26 1624:32:39”

走远了吗. 提交于 2019-12-13 08:17:59

问题


I'm generating a date string using the format yyyy-MM-dd HH24:mm:ss. However, when I attempt to parse the resulting string I get an error:

java.text.ParseException: Unparseable date: "2015-03-26 1624:32:39"

Full example:

SimpleDateFormat dateFormatterAPITS = new SimpleDateFormat("yyyy-MM-dd HH24:mm:ss");
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
cal.add(Calendar.DATE, 30); // add 30 days
Date newExpirationDate = dateFormatterAPITS.parse(
                           dateFormatterAPITS.format(cal.getTime())
                         );

回答1:


Change yyyy-MM-dd HH24:mm:ss to yyyy-MM-dd HH:mm:ss

More information about Date and Time Patterns



来源:https://stackoverflow.com/questions/28700147/java-text-parseexception-unparseable-date-2015-03-26-16243239

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!