I am trying to grab a range of dates from a calendar picker view and then put them into a string list to eventually be put into firebase firestore. I've been at this for some time but cannot get past the "parse" part of it. I've searched stackO and found most answers only pertain to a single date string as shown here which I have gotten to work. I'm just having issues with a list of dates.
this is what I have so far:
CalendarPickerView bookProfileCalendar;
DateFormat dateRangeInputFormat = new SimpleDateFormat("EEE MMM d HH:mm:ss z yyyy", Locale.US);
SimpleDateFormat dateRangeOutputFormat = new SimpleDateFormat("dd-MM-yyyy", Locale.US);
List<Date> testListDate = bookProfileCalendar.getSelectedDates();
for (Date x: testListDate){
String selectedDatesFormatted = dateRangeInputFormat.format(x); //this allows the input to be read as a date in its default format
String test = String.valueOf(selectedDatesFormatted); //not sure this is necessary
// Date test2 = dateRangeInputFormat.parse(test); // <-- this gives me parse underlined red saying "unhandled exception: java.text.ParseException
Log.d(TAG, "onClick: testList dates: " + test);
}
any help or guidance is appreciated.