Super Nooneof
Super Nooneof

Reputation: 1

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

this is my code:

    SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
    Date date = sdf.parse("130625143100");

i have a long list of date strings, all in the same format as above one, wierd thing is some success, some fail.

can any one help out with WHY this happens.

thanks a lot.

Upvotes: 0

Views: 185

Answers (3)

Juned Ahsan
Juned Ahsan

Reputation: 68715

You may need to validate your strings, for example if the value of month is greater than 12 then it will fail or for similar reasons.

Upvotes: 0

Optional
Optional

Reputation: 4507

You said, some string parses well while some string fails. Put your code in trycatch block. Log the string for which it is failing. The string may not be as per the format you specified in SimpleDateFormat

Upvotes: 1

shreyansh jogi
shreyansh jogi

Reputation: 2102

  SimpleDateFormat sdf = new SimpleDateFormat("yyMMddHHmmss");
    Date date = sdf.parse("130625143100");

mistake in doblue quote

Upvotes: 0

Related Questions