I have come across a real strange behavior of the class java.text.DateFormat. The code listed below executes properly on one Eclipse environment but gives "java.text.ParseException: Unparsable date" on another one!
Can anyone please throw some light as to what could be the possible issue here?
I'm surprised that it works at all. The reason why this may or may not work depends on what version of Java you use, what the locale setting is and possibly other factors.
Looking at this line:
Format specifiers such as DateFormat.MEDIUM are really not meant to be used for parsing, but only for formatting dates. The Java API documentation does not even explain in detail what the format is when you use DateFormat.MEDIUM, so if you use this for parsing, you don't know what strings will be accepted and what will be rejected.
You'd better use SimpleDateFormat for parsing date strings, so that you can specify the format yourself, for example:
I don't know if this accepts all uppercase letters for the month name, such as "JUNE" in your example. See the documentation of SimpleDateFormat for more information on how to specify the format string.