I am facing issue with Date.parse() method for non-English locale with English OS. I am using the Date.parse() method to parse the entered value of date. It would be different for different locales. Here are some examples. 03-Feb-2016 00:00 English 01.Feb.2016 00:00 Germany 2016-2-01 00:00 Japanese
So for German locale, above string (01.Feb.2016 00:00) pass to the parse()
try
{
Date.parse( value );
}
catch( IllegalArgumentException e )
{
valid_value= false;
}
where value is "01.Feb.2016 00:00" then it goes to catch block. Please help me on how can I validate the value or convert the value acceptable by English locale.
SimpleDateFormatis usually the way to go for all your parsing needs...