PM « SimpleDateFormat « Java Data Type Q&A





1. Why parsing '23:00 PM' with SimpleDateFormat("hh:mm aa") returns 11 a.m.?    stackoverflow.com

Finally I managed to understand what the problem was. I should hold on my string 11 PM instead of 23 PM What I don't understand is why parsing '23:00 PM' with SimpleDateFormat("hh:mm ...

2. Unable to parse DateTime-string with AM/PM marker    stackoverflow.com

The string I want to format looks like this: String datetime = "9/1/10 11:34:35 AM" Following pattern for SimpleDateFormat works:

SimpleDateFormat sdf = SimpleDateFormat("M/d/yy h:mm:ss");
Date d = sdf.parse(datetime);
System.out.println(d);

Output> [Wed Sep 01 11:34:35 CEST 2010]
However ...

3. Java SimpleDateFormat format for 02-Sep-10. 16:55PM    stackoverflow.com

Using simpleDateformat I have to format a Date object as following

02-Sep-10. 16:55PM

4. SimpleDateFormat class showing AM when it should be PM & vice versa?    coderanch.com

Hi, I am using the SimpleDateFormat class to format a time display (hours:minutes AM/PM). Everything works good except the AM/PM settings are appearing backwards. Any idea what I am doing wrong? Here's the code: In a javaBean I set the time from a 4 digit int from a legacy system. For example 1500 is 3pm. public void setPropCheckInTime(int CheckInTime) { int ...