title: How to display date and time(12 hour format) from seconds in java
body: <p>Hi I have seconds as follows</p>
  
  <pre><code>long seconds = 1299671538L;
  </code></pre>
  
  <p>Using the above seconds I want to display the date and time(12 hour format).<br>
  I have written code as follows:</p>
  
  <pre><code>SimpleDateFormat formatter = new SimpleDateFormat(
                               "EEEE, MMMM d, yyyy HH:mm,a", Locale.getDefault());
  String dateString = formatter.format(new Date(seconds * 1000L));
  System.out.println(dateString);
  </code></pre>
  
  <p>I am getting output as <code>Wednesday, March 9, 2011 17:22,PM</code>.</p>
  
  <p>But I want to display <code>Wednesday, March 9, 2011 05:22,PM(12 hour format)</code></p>