I want to be able to enter a date as in the code below and as well as print the day in the following format: "Sun Jan 01 00:00:00 GMT 2017" I also want to save the day of the week in a string variable. I would be extremely grateful for anyone that could help with this. Many thanks in advance!
import java.util.*;
import java.text.*;
public class Run {
public static void main(String args[]) {
try {
Scanner kb = new Scanner (System.in);
System.out.println("Please enter day of deadline: ");
String day = kb.nextLine();
System.out.println("Please enter month of deadline: ");
String month = kb.nextLine();
System.out.println("Please enter year of deadline: ");
String year = kb.nextLine();
String complete = (""+day+month+year);
Date date = new SimpleDateFormat ("ddMMyyyy" ).parse(complete);
System.out.println(date);
} catch (ParseException e) {
e.printStackTrace();
}
}
}