1

When I get the date from my JDateChooser I get something like:

Fri Nov 02 23:20:32 EST 2012

I've tried using SimpleDateFormat but I get an error saying it's unparseable.

I need the date in format: "yyyy-MM-dd"

This is the API of the JDateChooser I'm using: http://www.toedter.com/en/jcalendar/api/com/toedter/calendar/JDateChooser.html

user1709291
  • 43
  • 1
  • 8

1 Answers1

1

I appear to have been using SimpleDateFormat incorrectly.

The solution is:

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
String startDateString = dateFormat.format(projectStartDateJDateChooser.getDate());
user1709291
  • 43
  • 1
  • 8