Sorry for bringing this up, but I don’t see it. I have date+time in such format:
dd-MM-yy HH:mm
For example
15-11-11 09:36
(at the time of writing, it indicates date 5 days ago). When I try to run:
new java.text.SimpleDateFormat("dd-MM-yy HH:mm").parse("15-11-11 09:36")
I get exception:
java.text.ParseException: Unparseable date: “15-11-11 09:36”
At first I thought it is something with year (despite (-80,+20) boundary — according to documentation). Well, maybe, but when I remove time (from string and pattern), the date is recognized correctly.
Does anyone see what I don’t see?
Update
My system (Linux) short date format:
YYYY-MM-DD
long:
WEEKDAY DD MONTH YYYY
and time:
HH:MM:SS
However I thought the purpose of giving the pattern is to be locale independent.
Out of curiosity I added “:ss” to pattern and “:01” to string, still exception.
I can just estimate but I think that you copy/pasted either format fragment or the date. And by mistake inserted different semicolon character in both cases. The characters look the same but are different.
So, I suggest you to take your working example without time and type manually
HH:mmand10:36. If it does not work, I am really sorry. :(. If it does try first to change10to09. This is to be sure that it takes numbers with leading zeros.