SimpleDateFormat parse resets hours and minutes

android, date, java, simpledateformat, time

Solution

You need the pattern `"yyyy-MM-dd'T'HH:mm:ssXXX"` to parse your date. (`"XXX"` stands for the `timezone`)

In your case the second `"HH:mm"` is resetting the values and using the last parsed data.

Problem

I get a date as String like `"start_date": "2013-07-05T11:32:00+00:00"` and need a date object, which represents it with hours and minutes. If I use the format `"yyyy-MM-dd'T'HH:mm:ss+HH:mm"` and `sdf.parse(startDate)` , in the returned date object the hours and minutes are resetted. But I need also hours and minutes for date comparison. How can I workaround this problem ?

Original source