sample string is: 25-11-2015 14:59
String str= "25-11-2015 14:59";
I want to convert the str to Date. But it gives me an error. My conversion function is
public Date getDate(String date)
{
try {
Log.v("Date","Date string: "+date);
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
Date convertedDate = new Date();
convertedDate = dateFormat.parse(date);
return convertedDate;
} catch (Exception e)
{
Log.v("error","error date parse : "+e.getMessage());
return null;
}
}
But it showing error :
Unparseable date: "25-11-2015 14:59" (at offset 16)
can anyone help me where is the problem
dd-MM-yyyy HH:mminstead ofdd-MM-yyyy hh:mm:ss.