I am storing the current date in SQLite db using the variable CURRENT_DATE. I found that the date format used is yyyy-mm-dd
in the same. I want to parse the date in the code but I get this error:
java.lang.IllegalArgumentException: Parse error: at java.util.Date.parseError
The code is shown below:
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd");
String formattedTaskDate = dateFormat.format(new Date(dateStoredAsStringFetchedFromDB));
Date d = new Date(formattedTaskDate);
At first, I am fetching the date from the database and storing it in a String variable (because date is stored as TEXT in SQLite) and then I am performing the above operations but I get the exception as parseError.
How can I solve this issue?