How to get localized short day-in-week name (Mo/Tu/We/Th...)

fhucho picture fhucho · Sep 24, 2010 · Viewed 51.1k times · Source

Can I get localized short day-in-week name (Mo/Tu/We/Th/Fr/Sa/Su for English) in Java?

Answer

RealHowTo picture RealHowTo · Sep 24, 2010

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