Ti lascio un programmino di test a guida:
codice:
import java.text.*;
import java.util.*;
/**
*
* @author Andrea
*/
public class LocaleFormat {
public static void main (String[] args) throws Exception {
Locale def = Locale.getDefault();
System.out.println(def);
SimpleDateFormat dbFormat = new SimpleDateFormat("yyyy-MM-dd");
//test Locale
Date d = new Date();
Locale[] locale = new Locale[]{Locale.US, Locale.ITALY, Locale.JAPAN};
String[] formattedDates = new String[locale.length];
for (int i = 0; i < locale.length; i++) {
SimpleDateFormat sdf = (SimpleDateFormat)DateFormat.getDateInstance(DateFormat.SHORT, locale[i]);
formattedDates[i] = sdf.format(d);
System.out.println(sdf.format(d));
}
// parsing
System.out.println("___________\n\nLet's parse\n_____________");
for (int i = 0; i < locale.length; i++) {
SimpleDateFormat currFormatter = (SimpleDateFormat)DateFormat.getDateInstance(DateFormat.SHORT, locale[i]);
Date parsedDate = currFormatter.parse(formattedDates[i]);
System.out.println(dbFormat.format(parsedDate));
}
}
}