I want to print localized one character day name in java using something like DateFormat. Like: "S" for Sunday "M" for Monday
But should be able to work for other locales too.
I want to print localized one character day name in java using something like DateFormat. Like: "S" for Sunday "M" for Monday
But should be able to work for other locales too.
You can try like this :
public class test {
public static void main(String[] args) {
Locale locale = Locale.getDefault();
DateFormat weekdayNameFormat = new SimpleDateFormat("E", locale);
String weekday = weekdayNameFormat.format(new Date());
System.out.println(weekday.charAt(0));
}
}