title: correcting doctrine datetime on oracle
body: <p>I'm using doctrine for persistence and all of my dates are off. They're being stored as +6 when they should be -6(America/Chicago). I have php and the app server on America/Chicago and can confirm that by the following:</p>
  
  <pre><code>php &gt; echo (new \DateTime())-&gt;format('Y-m-d h:m:i a e');
  2016-03-02 02:03:47 pm America/Chicago
  </code></pre>
  
  <p>I've created a table in oracle to debug with:</p>
  
  <pre><code>  CREATE TABLE "APP"."DATE_TEST" 
     (    "ID" VARCHAR2(36 BYTE), 
      "LOCALTZ" TIMESTAMP (0) WITH LOCAL TIME ZONE, 
      "NOTLOCALTZ" TIMESTAMP (0) WITH TIME ZONE
     )
  </code></pre>
  
  <p>I have a test entity with the following doctrine mapping:</p>
  
  <pre><code>Acme\Project\Domain\Asset\Entity\DateTest:
      type: entity
      table: DATE_TEST
  id:
      id:
          type: guid
          generator:
              strategy: none
  fields:
      localtz:
          type: datetime
          column: localtz
      notlocaltz:
          type: datetimetz
          column: notlocaltz
  </code></pre>
  
  <p>I execute some code to push the data into the table:</p>
  
  <pre><code>protected function execute(InputInterface $input, OutputInterface $output)
      {
          $test = new DateTest();
          $datetime = new \DateTime();
          $test-&gt;setLocalTz($datetime);
          $test-&gt;setNotLocalTz($datetime);
          $output-&gt;writeln($test-&gt;getId());
          $output-&gt;writeln($datetime-&gt;format('Y-m-d h:i:s a'));
          $output-&gt;writeln($datetime-&gt;getTimezone()-&gt;getName());
          $em = $this
              -&gt;getContainer()
              -&gt;get('doctrine.orm.entity_manager');
          $em-&gt;persist($test);
          $em-&gt;flush();
          $output-&gt;writeln("Test complete.");
      }
  </code></pre>
  
  <p>The following gets outputted </p>
  
  <pre><code>de4e5dcd-9fd6-4b5d-b9f0-6db9d1ef0582
  2016-03-02 02:51:02 pm
  America/Chicago
  Test complete.
  </code></pre>
  
  <p>And this is what i see in the database</p>
  
  <pre><code>de4e5dcd-9fd6-4b5d-b9f0-6db9d1ef0582    02-MAR-16 08.51.02.000000000 AM 02-MAR-16 02.51.02.000000000 PM +06:00
  </code></pre>
  
  <p>I've got the <a href="http://www.doctrine-project.org/api/dbal/2.0/class-Doctrine.DBAL.Event.Listeners.OracleSessionInit.html" rel="nofollow">oracle session init</a> hooked up.</p>
  
  <p>When I query the database for the current time, it looks correct:</p>
  
  <pre><code>SELECT SYSTIMESTAMP "NOW" FROM DUAL;
  02-MAR-16 02.56.44.342456000 PM -06:00
  </code></pre>
  
  <p>Can anyone spot what I'm doing wrong? </p>