try {
SimpleDateFormat format = new SimpleDateFormat("YYYY-MM-DD'T'HH:mm:ss+hh:mm");
Date dateTime = format .parse("2020-11-22T05:57:10+01:00");
System.out.println(dateTime);
} catch (ParseException e) {
e.printStackTrace();
}
Above out put is Sun Dec 29 05:00:10 IST 2019
the 57
minutes part is lost.
The above date I am receiving from JSON response with TimeZone Europe/Berlin
.
Currently I haven't include TimeZone. What is correct way to address this string while converting into Java Date object?
Does the above conversion is correct ? If not then how to convert this data ?