That happens because you are using SimpleDateFormat
which is by default lenient. If you turn leniency off by setting setLenient(false):
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSSZ", Locale.getDefault());
dateFormat.setLenient(false);
You will get an exception saying:
java.text.ParseException: Unparseable date: "2017-07-19T13:43:42.000+0000"
The root cause here is that you are submitting 13
for hours which requires HH
pattern instead of hh
. Because of leniency your code silently fixes the date instead of throwing an exception.
H Hour in day (0-23)
h Hour in am/pm (1-12)