PDave PDave - 2 months ago 9
Java Question

Date format and the hour is always 12:00:00.000

I got the problem with date format

yyyy-MM-dd'T'hh:mm:ss.SSS'Z'
, always when I parse some date the time is set to
12:00:00.000
.

This is my date formater:

DateFormat xmlDateFormatWithMs = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss.SSS'Z'");

Answer

You seem to need 24-hours hour format. You need:

"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"

With capital HH to specify you need a 24-hours format.