javadatedatetimedatetime-parsing

UnParseable Date Exception :"2015-02-06T16:05:20"


I have a Date Variable "StartTime", in which i need to store this input String "2015-02-06T16:05:20"

I tried like below, but it gives Unparsable Date Exception. What i am doing wrong?

DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String inputTime = "2015-02-06T16:05:20";
setStartTime(dateFormat.parse(inputTime));

Solution

  • You can change you date format to "yyyy-MM-dd'T'HH:mm:ss"

    Read more Java SimpleDateFormat