title: Format 12h format timestamp string to TIME in iDB2
body: <p>I need a iSeries DB2 SQL query which can transform this timestamp <code>1/1/1900 12:00:00 AM</code> into <code>00:00:00</code> (handling the 12h to 24h time convertion). The scalar functions I've used don't handle this time format, the only way I managed to support this was with the following query:</p>
  
  <pre><code>SELECT (
      CASE 
      WHEN LOCATE('PM', '1/12/1900 12:00:00 AM') = 0 THEN 
      REPLACE(CHAR(TIME(TIMESTAMP_FORMAT('1/12/1900 12:00:00 AM', 'DD/MM/YYYY HH24:MI:SS'))) , '.', ':' )
      ELSE
      REPLACE(CHAR(TIME(TIMESTAMP_FORMAT('1/12/1900 12:00:00 AM', 'DD/MM/YYYY HH24:MI:SS')) + 12 HOURS) , '.', ':' )
      END) 
  FROM SYSIBM.SYSDUMMY1;
  </code></pre>
  
  <p>Is there a better way to achieve the objective ?</p>
  
  <h1>EDIT 6/JUN/2014</h1>
  
  <p>I've found that it might be possible to set the date format (ISO,USA, ...) in the connection string, which would solve all of the problems I'm currently having with this, but, I haven't found the correct parameter name to achieve that.</p>