I wish to get a localized date string. For that, I'm doing:
String dateString = "2019-06-01 00:15:00";
dateString = dateString.replace(" ", "T");
dateString = dateString.concat("Z");
DateFormat dateformat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM, Locale.FRENCH);
System.out.println(dateformat.format(dateString));
But I'm getting the following exception:
java.lang.IllegalArgumentException: Cannot format given Object as a Date
What could be wrong here?