import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
public class MainClass{
public static void main(String[] argv){
int[] styles = { DateFormat.SHORT, DateFormat.MEDIUM,
DateFormat.LONG, DateFormat.FULL };
Locale[] locales = { Locale.FRANCE,
Locale.CHINA,
Locale.ITALY };
Calendar cal = Calendar.getInstance();
Date date = cal.getTime();
for (Locale loc:locales) {
System.out.format("\n%10s:\n", loc.getDisplayCountry());
for (int style:styles) {
DateFormat df = DateFormat.getDateInstance(style, loc);
System.out.println(df.format(date) + "\n");
}
}
}
}
France:
13/04/10
13 avr. 2010
13 avril 2010
mardi 13 avril 2010
China:
10-4-13
2010-4-13
2010?4?13?
2010?4?13? ???
Italy:
13/04/10
13-apr-2010
13 aprile 2010
martedì 13 aprile 2010