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())
);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…