hello guys I've been on this issue for 4 hours and I don't seem able to solve it. I want the date selected using JDateChooser to be converted to this format dd-mm-yyyy but I couldn't do this. This what I wrote but it prints the date as :Thu Aug 21 00:00:00 WEST 2014. I want it to be printed 21-08-2014 This is my code:
public void addIns() {
JTextField ch=(JTextField) dateChooser.getDateEditor().getUiComponent();
SimpleDateFormat df = new SimpleDateFormat("dd-MM-yyyy");
try{
Date date = df.parse(ch.getText());
} catch(Exception e){System.out.println("wrong date");}
System.out.println(date); }