For Example I have the date: \"23/2/2010\" (23th Feb 2010). I want to pass it to a function which would return the day of week. How can I do this?
I
One line answer:
return LocalDate.parse("06/02/2018",DateTimeFormatter.ofPattern("dd/MM/yyyy")).getDayOfWeek().name();
Usage Example:
public static String getDayOfWeek(String date){
return LocalDate.parse(date, DateTimeFormatter.ofPattern("dd/MM/yyyy")).getDayOfWeek().name();
}
public static void callerMethod(){
System.out.println(getDayOfWeek("06/02/2018")); //TUESDAY
}