vendredi 24 avril 2015

Parse Error while parsing date in Android

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

Aucun commentaire:

Enregistrer un commentaire