I’m trying to parse a Finnish date using the examples I’ve found here on Stack Overflow but I keep getting a parsing exception.
Here’s my snippet:
SimpleDateFormat dftFormat = new SimpleDateFormat("dd MMMM yyyy", new Locale("fi", "FI"));
Date datDate = dftFormat.parse("25 syyskuu 2012");
The DateFormat characters seem to the same as the one in English so i’m wondering why this doesn’t work.
Here’s the information about the Finnish locale.
Thanks.
It seems that all Finnish dates end with a ta i.e.
syyskuubecomessyyskuuta.The locale reference that I gave was wrong. If you see that link, you’ll notice that the
tais missing and that was some misleading information. I couldn’t find the exact locale information for the Finnish locale in the Javadocs.I learnt a lesson, thanks to @Eis and @Fildor, print out the date using your parsing format to see what the resultant string is. Then you can compare whether your input string is parseable using the format.
Here’s how I tested my code: