date format parses the 12th-hour value (hh) to 00 while applying the format as "yyyy-MM-dd'T'hh:mm:ss" but it does not parse the 13th hour to 1 PM. PFB the sample code piece.
Date testDate = DateUtil.parse("yyyy-MM-dd'T'hh:mm:ss", "2010-07-09T12:50:58");
can you please let me know why this is converting so?
You should use HH instead of hh. The former is for 24-hour clock, the latter for a 12-hour clock.
See the javadoc for SimpleDateFormat.
EDIT: Note that the problem may be at the other end too. To get the hour from a java.util.Date, you can set it on a Calendar object and call get(Calendar.HOUR_OF_DAY). Note that get(Calendar.HOUR) will give you the 12-hour rather than the 24-hour.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With