Reputation: 1434
Hello I have ParseException when I try to use SimpleDateFormat
:
this.firstTweetTime = new SimpleDateFormat("mm/dd/yyyy HH:mm",Locale.US).parse(array[4]);
where array[4]
is a string from text file I read and it is like this: 12/8/2010 11:48
I get the following error:
I cannot understand what went wrong. can you please help me.
Upvotes: 1
Views: 688
Reputation: 1434
The reason why I had such exception was not related to Date Format rather that it was related to the source text file itself. turns out that the file was saved as unicode format while it should be saved as UTF-8 format. that's the reason why the data looked corrupt in the exception while I can read it from the file normally it was not processed through my application.
Upvotes: 0
Reputation: 9
it looks like the date you are getting from your array has some characters that SimpleDateFormat cannot understand, put array[4] in a logger or another line where you can debug and see exactly what you are trying to parse.
Upvotes: 1