We need to know that the abbreviation or full name of the week in different countries is very different. For example, the United States uses Thu (Thursday) for the abbreviation (full name) of Thursday, Japan uses "木" (木曜日) for the abbreviation of (full name) Thursday, and Italy uses gio (full name). giovedi) abbreviation (full name) Thursday, etc.
If you want to use the week format of a specific region to represent the day of the week in a date, you can use the format overload method :
format(Localelocale, formatting mode, date list);
The parameter locale is an instance of the Locale class , used to represent the region.
The static constants of the Locale class are all Locale objects, where US is a static constant representing the United States. We can consult the Java API or decompile the Locale class to learn about the static constants representing different countries.
For example, assuming that the current time is 2012-02-12, for (%ta represents the abbreviated day of the week):
Strings=String.format(Locale.US,%ta(%<tF),newDate());
Then s is Sun (2012-02-12), for (%tA represents the full name of the week):
Strings=String.format(Locale.JAPAN,%tA(%<tF),newDate());
Then s is Sunday (2012-02-12). (Monday to Sunday in Japan correspond to Sunday, Fire Sunday, Mercury, Jupiter, Venus, Earth Sunday, and Sunday)
Note: If the format method does not use the Locale parameter to format the date, and the locale setting of the system where the current application is located is China, then it is equivalent to taking Locale.CHINA as the locale parameter.