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");
}
}
}
}
|