This is my datepicker function.
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, year);
c.set(Calendar.MONTH, month);
c.set(Calendar.DAY_OF_MONTH, dayOfMonth);
String rideDateString = DateFormat.getDateInstance(DateFormat.SHORT).format(c.getTime());
}
Here the output will be in the format
'm/d/yy'
. That is, for example: '3/9/20'
for 9th march 2020
.
I want a output like 'mm-dd-yyyy'
. That is, for example: '03-09-2020
for 9th march 2020'
.
What are the ways for achieving this result?