Write a java program to find Day of Week.

Write a program to read a string containing date in DD/MM/YYYY format and prints the day of the week that date falls on.
Return the day in the lowercase letter (Ex: Monday).

Input and Output Format:
Input consists of a string.
The output consists of a string.
Refer sample output for formatting specifications.

Sample Input 1:
Sample Output 1:

Day of Week in Java.

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Main {
  public static void main(String[] args) throws ParseException {

    Scanner sc = new Scanner(System.in);
    String s1 = sc.nextLine();

  public static String calculateBornDay(String s1) throws ParseException {
    SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
    SimpleDateFormat sdf1 = new SimpleDateFormat("EEEEE");
    Date d = sdf.parse(s1);
    String s = sdf1.format(d);
    return s.toLowerCase();


Add a Comment

Your email address will not be published. Required fields are marked *

three × four =