-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
  • 3,281
  • 4
  • 24
  • 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,720
  • 8
  • 32
  • 78