Times not formatting correctly
<p>I wanted to know is there a way to do what i am asking or would I just have to write totally new code. My string that i am comparing i still can only get it to display PM only if a time is 12 noon or midnight but i want for it to display PM after it hits 12 noon until it hits 12 in the midnight and the switch it back to AM. i change my code around a little to try to do this but its still not right: heres updated code:</p>

<p>Here's my updated code:</p>

<pre><code>for (cursor.moveToFirst(); !doBreak == true
                    &amp;&amp; cursor.moveToNext(); cursor.isAfterLast()) {
                // The Cursor is now set to the right position

                if (!mTime.substring(0, 2).equals("12")) {

                    am_pm = "AM";

                    if (mTime.length() == 3) {

                        a = mTime.substring(0, 1);
                        b = mTime.substring(1, 3);

                        s = a + ':' + b + " " + am_pm;

                    } else {

                        a = mTime.substring(0, 2);
                        b = mTime.substring(2, 4);

                        s = a + ':' + b + " " + am_pm;

                    }
                }

                else {

                    am_pm = "PM";

                    if (mTime.length() == 3) {

                        a = mTime.substring(0, 1);
                        b = mTime.substring(1, 3);

                        s = a + ':' + b + " " + am_pm;

                    } else {

                        a = mTime.substring(0, 2);
                        b = mTime.substring(2, 4);

                        s = a + ':' + b + " " + am_pm;

                    }
                }
</code></pre>
