Here is my INPUT DATE:
String myDate = "2010-02-19";
I want to get OUTPUT from above DATE like below:
Friday, 19-Feb-2010
I tried many way for getting exact output but not success yet.
Here is my code that i trying using DateTimeFormatter and SimpleDateFormat:
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String myDate = "2010-02-19";
String strDateTimeFormatter, strSimpleDateFormat;
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("EEEE, dd-MMM-yyyy", Locale.US);
LocalDate localDate = LocalDate.parse(myDate, dateTimeFormatter);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEEE, dd-MMM-yyyy");
strSimpleDateFormat = simpleDateFormat.format(myDate);
strDateTimeFormatter = String.valueOf(localDate);
Log.d("TAG", "DateTimeFormatter: "+strDateTimeFormatter);
Log.d("TAG", "SimpleDateFormat: "+strSimpleDateFormat);
}
});
I get java.time.format.DateTimeParseException: Text '2010-02-19' could not be parsed at index 0
from the following line:
LocalDate localDate = LocalDate.parse(myDate, dateTimeFormatter);
How to get the actual OUTPUT that i want?