If I do this
DateTime dateTime = DateTime(2022, 5, 1); // Sunday
print(DateFormat("E").format(dateTime));
Sun will be printed out to the console. Which is what I expected.
This also works if I change the system language.
How to printout the localized One Letter weekday abbreviation?
e.g. M T W T F S S
I thought I can get first letter using "substring", but it won't be correct for all languages. For example, Spanish weekdays are: Lunes, Martes, Miércoles, Jueves, Viernes, Sábado and Domingo, and first letter for "Miércoles" is X instead of M to difference it from "Martes".
In Java you could do something like this to get the One Letter abbreviation:
new SimpleDateFormat("EEEEE", Locale.getDefault());
simpleDateFormat.format(date);
For Spanish the output would be L M X J V S D
DateFormat("E").format(dateTime)[0]
but not sure if that is good enough – Samoyedic