package assignment1;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;
public class Assignment1 {
public static void main(String[] args) throws ParseException {
Scanner input = new Scanner(System.in);
SimpleDateFormat SDformat = new SimpleDateFormat("MM/dd/yyyy");
System.out.println("Enter Date (Month/Day/Year) :");
String dinput = input.nextLine();
Date date1 = null;
if (dinput != null && dinput.trim().length() > 0)
date1 = SDformat.parse(dinput);
System.out.println(date1);
}
}
the code it makes the user to put any random date , and it will give the day only without time or date just the day like (Thursday) like this only
input : 07/13/2021 Output : Tue Jul 13 00:00:00 EEST 2021
I want to display just the day like Tuesday .