LeetCode 1185 Day of the Week in Java – John Canessa public static String getDayStringNew(LocalDate date, Locale locale) { DayOfWeek day = date.getDayOfWeek(); return day.getDisplayName(TextStyle.FULL, locale); } ofPattern ("d/M/uuuu")). DayOfWeek getDisplayName() method in Java with Examples Java Date and Time First, we extract the day as a number using java.util.Calendar: public static int getDayNumberOld(Date date) { Calendar cal = Calendar.getInstance (); cal.setTime (date); return cal.get (Calendar.DAY_OF_WEEK); } The resulting number ranges from 1 (Sunday) to 7 (Saturday). java.time.DayOfWeek的getDisplayName()方法是Java中的一个内置函数,它根据指定的Locale类参数和TextStyle返回day-of-week的文本表示形式。 TextStyle定义了三个元素“ FULL”,“ SHORT” … Java -Day of the week using Java 8 DayOfWeek Enum | Code2care Exploring code transformation from Ruby to Scala. Taken from http ...