如何获得本地化的短星期名称(Mo/Tu/We/Th...)
我能否在 Java 中获得本地化的短星期名称(英语为 Mo/Tu/We/Th/Fr/Sa/Su)?
Can I get localized short day-in-week name (Mo/Tu/We/Th/Fr/Sa/Su for English) in Java?
推荐答案
最好的办法是用 java.text.DateFormatSymbols
The best way is with java.text.DateFormatSymbols
DateFormatSymbols symbols = new DateFormatSymbols(new Locale("it"));
// for the current Locale :
// DateFormatSymbols symbols = new DateFormatSymbols();
String[] dayNames = symbols.getShortWeekdays();
for (String s : dayNames) {
System.out.print(s + " ");
}
// output : dom lun mar mer gio ven sab
相关文章