I'm writing a program that asks the user for their birthdate and then calculates that birthdate on different planets. I am not suppose to assume how the birthdate is to be enter except that there is one white space between each number.
The code I have right now does not meet these specifications right now and I'm not sure how to write it otherwise. I am also having problem calculating what my age would be today. When I enter my birthdate and print out age, it currently tells me that I'm 407 yet when I print out dateBirth and today, both of those dates are correct
System.out.print("Please enter your birthdate (mm dd yyyy): ");
birthdate = scan.nextLine();
DateFormat df = new SimpleDateFormat("MM dd yyyy");
Date dateBirth = df.parse(birthdate);
Calendar calBirth = new GregorianCalendar();
calBirth.setTime(dateBirth);
Calendar calDay = new GregorianCalendar();
today = calDay.getTime();
age = (today.getTime() - dateBirth.getTime()) / (1000 * 60 * 60 * 24 * 365);