I'm storing dates in a database as a single string
in the format "2 15 2015" (presumably "M d yyyy"?). strDate
in the code below contains the return value of a method that grabs the date. I want to parse the date so as to set a datepicker
. Based on the examples in Java string to date conversion
I've created the following code for parsing the date, but am getting an "Unhandled Exception: java.text.ParseException
" at
Date date = format.parse(strDate);
Scratching my head.
Calendar mydate = new GregorianCalendar();
String strDate = datasource.get_Column_StrVal(dbData,
MySQLiteHelper.dbFields.COLUMN_SPECIAL_DAYS_DATE);
SimpleDateFormat format = new SimpleDateFormat("M d yyyy", Locale.ENGLISH);
Date date = format.parse(strDate);
mydate.setTime(date);