One can obtain the first day of week on JVM by calling Calendar.getInstance(locale).getFirstDayOfWeek()
. Yet, is this information language-based, or country-based?
As it turns out, this is JDK version-dependent. JDK8 returns first day of week based on language, so it returns SUNDAY
for "en_FI"
"en_US"
and MONDAY
for "fi_FI"
and "fi_US"
.
However, JDK9 switched to the CLDR system which (more logically) uses country. So, JDK9 will return MONDAY
both for "en_FI"
and "fi_FI"
locales, and will return SUNDAY
for "fi_US"
and "en_US"
.
See JEP 252 for more details.
Also, quoting from JDK-8203280:
To add an explanation to this behavior, the CLDR implementation is correct, i.e., the first day of week should be defined by the region, not by the language.
According to the documentation, it is country-based: https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#getFirstDayOfWeek()
Gets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With