I want to convert a string to date before storing it and I used
SimpleDateFormat format = new SimpleDateFormat(\"yyyy-mm-dd\");
Date returnDate = format.parse(d
You can use like this :
Date mDate= new Date(System.currentTimeMillis());
SimpleDateFormat mDateFormat= new SimpleDateFormat("dd MMM yyyy HH:mm a");
String dateformat=mDateFormat.format(mDate);
the string ["dd MMM yyyy HH:mm a"] can be changed according to need of formate.
Like in your case : "yyyy-mm-dd