After reading the accepted answer to Date formatting based on user locale on android for german, I tested the following:
@Override
protected void onResume() {
super.onResume();
String dateOfBirth = "02/26/1974";
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
Date date = null;
try {
date = sdf.parse(dateOfBirth);
} catch (ParseException e) {
// handle exception here !
}
// get localized date formats
DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext());
String s = dateFormat.format(date);
dateTV.setText(s);
}
Here dateOfBirth is an english date. If I change the phone's language to German however, I see 02.26.1974. According to http://en.wikipedia.org/wiki/Date_format_by_country, the proper localized german date format is dd.mm.yyyy, so I was hoping to see "26.02.1974".
This leads to my question, is there a way to fully localize dates or is this a manual process where I must pore through my app for dates, times, etc.?