-3

I have a date as a String "20161006133408" in the format "yyyyMMddhhmmss". So I make things like:

DateFormat dfmt2 = new SimpleDateFormat( "yyyyMMddhhmmss" );
dfmt2.setLenient(false);

try {
    Date d = dfmt2.parse(updateTimeDate);
} catch{...}

And I get the following Exception at the line where I parse:

java.text.ParseException: Unparseable date: "20161006133408"

Any ideas?

Thanks.

hpopiolkiewicz
  • 2,702
  • 3
  • 22
  • 36
user2784676
  • 105
  • 1
  • 12

1 Answers1

0

Use HH for hours instead. HH takes 24-hour, hh takes 1-12 (am/pm).

http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html

Daniel Paczuski Bak
  • 3,208
  • 6
  • 26
  • 65