Find the calender based on Birthday in shell script

package com.fahad;

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

    System.out.println("Enter Your Birthday;");

    System.out.println("follow [month-date-year] sequence:");

    Scanner sc=new Scanner(System.in);

    String date=sc.next();

    //FILL CODE

    Birthday a= new Birthday();

    System.out.println(a.findDay(date));

}

}
package com.fahad;

import java.util.Date;

import java.text.*;

public class Birthday {

public String findDay(String date)

{

    //FILL CODE

    SimpleDateFormat sf = new SimpleDateFormat("MM-dd-yy");

    sf.setLenient(false);

    try {

        Date date1=sf.parse(date);

        sf=new SimpleDateFormat("EEEE");

        return sf.format(date1);

    } catch(ParseException e) {

        return "Invalid Date";

    }

}

}

How is this any different to what you posted yesterday ?

You show an (untested) Java version, and ask for a Bash solution, which you say you have written but does not quite work.

Try posting the Bash that you have, and show the input, and the output you get, and describe the problem.

Also show your OS distro, and the version of Bash that you have. With that background, you will get some help and advice.

1 Like

Given that this appears to be a duplicate of this thread, I'm going to close this one off now. @tonifahim, if you could get back to us with answers to the points I've raised on that original post, then we may be able to assist you further.

4 Likes