android date localization
<p>I'm storing a date as string somewhere in my app. like this:</p>

<pre><code>Date updatedDate = new Date();

SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(_context);
SharedPreferences.Editor editor = settings.edit();
editor.putString(Constants.Preferences.LastUpdateDateKey, updatedDate.toLocaleString());
editor.commit();
</code></pre>

<p>Everything works fine when the language is English.</p>

<p>But when I switch it to french. </p>

<p>this code throw an illegalArgumentException</p>

<pre><code>String lastUpdateDateString = settings.getString(Constants.Preferences.LastUpdateDateKey, null);

if(lastUpdateDateString!=null){             
            lastUpdateDate = new Date(Date.parse(lastUpdateDateString));             
        }
</code></pre>

<p>it throws at Date.parse</p>

<p>Both english and french, the updatedDate.toLocaleString() is in this format: 2011-12-16 22:13:32</p>

<p>It must have something to do with the language switch. Is there a way to say parse the date using a format?</p>
