Java – calendar #getfirstdayofweek() returns an incorrect value
I may ignore some incredibly obvious things, but why
final Calendar calendar = Calendar.getInstance(Locale.GERMAN); System.out.println(calendar.getFirstDayOfWeek());
cause
1 (Sunday)
replace
2 (Monday)
?
Before someone claimed that "the first day of the week is the Sunday of all German speakers", it was not: "[D] is the working day number, from 1 to 7, from Monday to Sunday."
In fact, locale Gemany will produce the correct Monday
Why is the German language environment on Sunday the first day of the week?
Solution
All default locales for a specific language, such as locale GERMAN,Locale. FRENCH,Locale. English does not specify part of the locale to the United States by default In fact, these constants represent German, French or English living in the United States
There may not be a good answer to this question, because only knowing the language is not enough to understand the first day of the week Perhaps because java was developed by American companies for the American market, the default locale value uses the United States as the country
If you need a German locale, use locale Gemany, as pointed out in other answers