import java.time.DayOfWeek; import java.time.LocalDate; public class Demo { public static void main(String[] args) { LocalDate currentDate = LocalDate.now(); System.out.println("Current Date = "+currentDate); DayOfWeek day = currentDate.getDayOfWeek(); int weekVal = day.getValue(); String weekName = day.name(); System.out.println("Week Number = "+weekVal); System.out.println("Week Name = "+weekName); } }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more