-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBirth.java
More file actions
25 lines (18 loc) · 759 Bytes
/
Copy pathBirth.java
File metadata and controls
25 lines (18 loc) · 759 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.util.Scanner;
import java.text.SimpleDateFormat;
import java.util.Date;
public class Birth{
public static void main(String[] args)throws Exception{
Scanner birth = new Scanner(System.in);
System.out.println("What is your birthdate? dd/MM/yyyy\n");
String input = birth.nextLine();
String sDate1=input;
Date date1 = new SimpleDateFormat("MM/dd/yyyy").parse(sDate1);
//System.out.println(date1);
String strDateFormat = "E";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
strDateFormat = "EEEE";
sdf = new SimpleDateFormat(strDateFormat);
System.out.println("You were born on a " + sdf.format(date1));
}
}