title: DateTime class returning incorrect timezone_type and timezone?
body: <p>I'm building a project which is creating countdowns to various events, and I'm trying to keep it as timezone-agnostic as possible by just using UTC globally to avoid errors and issues, almost exactly similar to the one I'm getting now. The basic process is this:</p>
  
  <ol>
  <li><p>Input Date/Time into database (stored similarly to ISO-8601):</p>
  
  <pre><code> 2009-08-07 06:05:04
  </code></pre>
  
  <p>PHP representation:</p>
  
  <pre><code> Y-m-d H:i:s
  </code></pre></li>
  <li><p>Store in database with <code>datetime</code> data type (which does not attempt to alter the datetimestamp from the server timezone to UTC - this would not be useful since I'm entering it in UTC anyway). </p></li>
  <li><p>Retrieve from database, and manipulate into RFC-2822-<em>like</em> format (I do this because the date/time then gets plugged into a Javascript countdown, and Safari only accepts this particular format of date/time, annoyingly enough):</p>
  
  <pre><code>07 Aug 2009 06:05:04
  </code></pre>
  
  <p>PHP representation:</p>
  
  <pre><code>d M Y H:i:s
  </code></pre></li>
  </ol>
  
  <p>All of this is done, like I say, in UTC to avoid issues that appear when you start adding in timezones. </p>
  
  <p>The issue I'm having appears to be occurring at or around step 3, where the date time gets reformatted. Here's my PHP function which does this:</p>
  
  <pre><code>function manipulateDateTime($inputDateTime, $utc_visible = true) {
     $temp = DateTime::createFromFormat('Y-m-d H:i:s', $inputDateTime);
     $outputDateTime = $temp-&gt;format('d M Y H:i:s');
  
     if ($utc_visible === true) {
        return $outputDateTime.' UTC';
     } else {
        return $outputDateTime;
     }    
  }
  </code></pre>
  
  <p>Then I discovered that the <code>DateTime</code> class had a constant aptly named <code>DateTime::RFC2822</code> which Safari actually does accept... cool, I can remove my PHP format from line 3, replacing this:</p>
  
  <pre><code> $outputDateTime = $temp-&gt;format('d M Y H:i:s');
  </code></pre>
  
  <p>with this:</p>
  
  <pre><code> $outputDateTime = $temp-&gt;format(DateTime::RFC2822);
  </code></pre>
  
  <p>But when I do this, <code>$outputDateTime</code> becomes equal to <code>Fri, 03 Jan 2014 22:57:00 +0100</code>. </p>
  
  <p><strong>Where did that extra +0100 come from?</strong></p>
  
  <p>The I decide to print <code>$temp</code>, my <code>DateTime</code> object:</p>
  
  <pre><code>DateTime Object ( [date] =&gt; 2014-01-03 22:57:00 [timezone_type] =&gt; 3 [timezone] =&gt; Europe/Berlin ) 
  </code></pre>
  
  <p><strong>Why am I seeing 'Europe/Berlin' and not 'UTC'?</strong></p>
  
  <p>A) I'm not in Europe/Berlin at all, I'm in New Zealand (UTC+13, if that matters), B) Why is not automatically formatted as UTC?</p>
  
  <p>I'm having a hard time wrapping my head around whether this affects the countdowns that are built off this data, it doesn't seem to alter it, but it certainly is frustrating and unexpected. Anyone have any reasons for this?</p>