We would like to know how to get display name for DayOfWeek in different locale.
import java.time.DayOfWeek; import java.time.format.TextStyle; import java.util.Locale; /*from ww w . j av a 2 s . c o m*/ public class Main { public static void main(String[] args) { Locale defaultLocale = Locale.getDefault(); Locale france = Locale.FRANCE; System.out.printf("%s%n", DayOfWeek.MONDAY.minus(401).getDisplayName(TextStyle.SHORT, defaultLocale)); System.out.printf("%s%n", DayOfWeek.MONDAY.minus(401).getDisplayName(TextStyle.SHORT, france)); } }
The code above generates the following result.