title: How to set format of current date time to different format?
body: <p>I use the following code to retrieve the current date and time, then add it to table using following method.</p>
  
  <pre><code> Change 2013-07-29 23:20:34.0 to 29th July 2013, 11:20 PM
  </code></pre>
  
  <p>DateTime</p>
  
  <pre><code> public Date getCurrentDateTime() {
          SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
          Date date = new Date();
          System.out.println("current:" + dateFormat.format(date));
          return date;
      }
  </code></pre>
  
  <p>Hibernate </p>
  
  <pre><code>@Temporal(javax.persistence.TemporalType.TIMESTAMP)
      public Date getCurrentDateTime() {
          return date;
      }
  </code></pre>