0

As a continuation of this question, the error doesn't seem to be resolved. The date in SQLite is stored as 2015-04-25 which is of the form yyyy-MM-dd. Now this date (which is system date) is stored in the db using CURRENT_DATE variable and fetched as a string. The minimal code is as shown below:

SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date taskDate = dateFormat.parse(dateFormat.format(new Date("2015-04-25")));

But I get an exception as:

Parse error: 2015-04-25

Community
  • 1
  • 1
Java Enthusiast
  • 1,161
  • 2
  • 15
  • 30

1 Answers1

1

Try this working code.

Format formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String formattedCode = formatter.format("supply your date-time here");

I believe you should either add time along with your date when you supply your input or you have to remove HH:mm:ss part.

Yuva Raj
  • 3,881
  • 1
  • 19
  • 30