I‘m fetching dates which have the format yyyy-MM-dd
.
I have these extracted as a string which would look like this:
String date = "2020-09-05";
Now I want to convert it into a EEE, d MMM yyyy
format, so the result should be: Sat, 5 Sep 2020
.
I tried reformatting it like this:
Date convertedDate = new SimpleDateFormat(EEE, d MMM yyyy).parse(date);
For some reason this and many tries to get around it all end up with a java.text.ParseException: Unparseable date "2020-09-05"
.
Can‘t I convert a date from a string like that? Is there a better way to reformat a string into other formats?