How to find day of week in java 8 for any given date

 In earlier version of java,you need to write lines of code to find day of week of a given date. In java 8, you can find it  in a single line of code. Java  8 has come up with a new date and time API (java.time) that  contains many classes such as  LocalDate, LocalTime, LocalDateTime etc. which are thread safe and  very user friendly to do many operations on date. 

 

In older version of Java, you can find day of week using  Calendar class or  DateFormat which is not thread safe.  Now let us see how to find Day of week using LocalDate class of Java 8  and also using old Calender class &  DateFormat.









You may also like

Leave a Reply

Be the First to Comment!