Hi all, I'm taking a class in Java and I need to convert a string to a date format (dd/MM/yyyy). I have been using the SimpleDateFormat to format my input, but it is showing the time, timezone and day of the week the date falls. Here is a snippet of my code:
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
Date date = new Date();
do{
y = JOptionPane.showInputDialog(null,
"Please enter the vehicle's registration date",
"Year?",
JOptionPane.QUESTION_MESSAGE);
try {
date = df.parse(y);
check = true;
}
catch (ParseException e) {
check = false;
}
}
while (check == false);
return date;
Anyone know how I can keep the format to just the date (e.g. 12/3/2000)? Thanks