Apparently, I am missing something fundamental. I am having a problem formatting a jspinner value. I tried a couple of different ways and keep getting the error, did not track them, except this is due to the way I am trying to grab the value from jspinner.
Here is the counter code:
SimpleDateFormat datePattern = new SimpleDateFormat("MM/dd/yyyy");
JSpinner dateFrom = new JSpinner(new SpinnerDateModel());
dateFrom.setEditor(new JSpinner.DateEditor(dateFrom, datePattern.toPattern()));
JPanel dateFromPanel = new JPanel(new GridLayout());
dateFromPanel.add(dateFrom);
dateFromPanel.setBorder(new TitledBorder("Date - From"));
This is how I am trying to get the format now:
SimpleDateFormat sdfSource = new SimpleDateFormat("MM/dd/yyyy");
Date from = sdfSource.parse(dateFrom.getValue().toString());
SimpleDateFormat sdfDestination = new SimpleDateFormat("MM/dd/yyyy");
String dosFrom = sdfDestination.format(from);
Current error: Exception in thread "main" java.text.ParseException: Unmatched date: "Mon Oct 23 00:00:00 EDT 2006"
source
share