The error "unparseable date" in Android usually indicates that you are trying to parse a date string using the SimpleDateFormat
class, but the date string is not in a format that can be recognized by the SimpleDateFormat
parser.
To fix this error, you will need to ensure that the date string you are trying to parse is in a format that is supported by the SimpleDateFormat
class. You can do this by specifying the correct format pattern when creating a SimpleDateFormat
object.
For example, if you are trying to parse a date string in the format "yyyy-MM-dd", you would use the following code:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date = sdf.parse(dateString);
If you are unsure of the format of the date string you are trying to parse, you can use the DateFormat.getDateInstance
method to get a DateFormat
object that can parse a variety of common date formats. You can then use this object to parse the date string.
For example:
DateFormat df = DateFormat.getDateInstance(); Date date = df.parse(dateString);