title: how to truncate yyyy/mm/dd hh:mm:ss.SSS to mm/dd/yyyy in oracle
body: <p>When I ran a query to get date it is retrieved in this format <code>'yyyy/mm/dd hh:mm:ss.SSS</code>' but I need to convert it to <code>mm/dd/yyyy</code>.</p>
  
  <p>I'm using this query for conversion </p>
  
  <pre><code>select 
      to_char(
          add_months (
              to_date(
                  to_char(
                      trunc(
                          TO_DATE('2016/01/01 00:00:00.0', 'YYYY/MM/DD HH24:MI:SS.SSS')
                      ), 'MM/DD/YYYY' -- to char
              ),'MM/DD/YYYY' -- to date
          ), -2*1  -- add months
      ), 'MM/DD/YYYY' -- to char
  ) START_DATE,
  
  to_char(
      add_months (
          to_date(
              to_char(
                  trunc(
                      TO_DATE('2017/01/01 00:00:00.0', 'YYYY/MM/DD HH24:MI:SS.SSS')
                  ), 'MM/DD/YYYY' -- to char
              ), 'MM/DD/YYYY'  -- to date
           ), 3 -- add months
      ), 'MM/DD/YYYY' -- to char
  ) END_DATE
  
  from dual;
  </code></pre>
  
  <p>Output is</p>
  
  <pre><code>ORA-01810: format code appears twice
  01810. 00000 -  "format code appears twice"
  </code></pre>