title: how to get am/pm using simple date format
body: <p>I want to get 12 hour clock time from milliseconds.I tried as follows</p>
  <pre><code>public class GetTimeFormat{
      static SimpleDateFormat format; 
      public static String convertDate(String dateformat,Long date){
          format = new SimpleDateFormat(dateformat);
          String formattedDate = format.format(date);
          return formattedDate;
      }
      
  public static void main(String args[])
  {
      
      long cal=1386059340010l;
      
      String dateString=convertDate(&quot;MMM dd,yyyy HH:mm:ss a&quot;, cal);
      System.out.println(dateString);
  
  }
  }
  </code></pre>
  <p>The corresponding date for the above milliseconds is <code>Tue Dec 03 13:59:00 IST 2013</code></p>
  <p>So I thought I will get formatted date as <code>Dec 03,2013 1:59:00 PM</code></p>
  <p>but instead I am getting <code>Dec 03,2013 13:59:00 PM</code></p>
  <p>there is no need for am/pm in 24 hour clock and in 12 hour clock am/pm is required</p>
  <p>But In my way I am getting time in 24 hour format + PM.</p>
  <p>Can Any body tell me whats the mistake here?</p>
  <p>Another question is why in <a href="https://ideone.com/HsbFu6" rel="nofollow noreferrer">ideone</a> its showing <code>Dec 03,2013 08:29:00 AM</code>
  Not only in ideone but I have checked many online compilers and every where its showing the same but in local machine time is different(13:59)</p>