title: Date formatting issue for sql format 'YYYY-MM-DD HH24:MI:SS.FF' to java
body: <p>In my sql query I have date formating as :</p>
  
  <pre><code>to_char(crtd_ts,'YYYY-MM-DD HH24:MI:SS.FF') crtd
  </code></pre>
  
  <p>and my database column stores the value as <code>2018-4-24.8.1. 30. 404577000</code></p>
  
  <p>What is the way of doing the same thing in Java?
  I tried this way, but I am getting an error.</p>
  
  <pre><code>private String formatDate(String refCrtdTs) {
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MMM-dd HH24:mm:ss.ff");
      String dateInString = refCrtdTs;
      try {
          Date date = sdf.parse(dateInString);
      } catch (ParseException e) {
          e.printStackTrace();
      }
      return null;
  }
  </code></pre>
  
  <p>I am trying to replace the above sql query with hibernate criteria. My hibernate entity for the column is defined as </p>
  
  <pre><code>@Column(name="REF_CRTD_TS",columnDefinition="timestamp")
  private String refCrtdTs;
  </code></pre>
  
  <p>and the column type in Oracle is <code>Timestamp</code>.
  So hibernate criteria returns me this value as String which I want to format now.</p>