I'm using the LGoodDatePicker with Apache NetbeansIDE 12.2 (https://github.com/LGoodDatePicker/LGoodDatePicker), and I need to get the date in the format YYYY-MM-DD. I'm using this code:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String date = sdf.format(datePicker1.getDate());
But I get this error:
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Cannot format given Object as a Date
Any suggestions? Thank you.