title: DateTime::__construct(): Failed to parse time string (131022120001Z) but the values comes from openssl_x509_parse()
body: <p>I'm using <code>openssl_x509_parse()</code> to parse a digital certificate.</p>
  
  <p>I've written an entity class that reads the array and transforms the values in objects.</p>
  
  <p>So, for dates I use <code>\DateTime()</code>.</p>
  
  <p>The problem is that sometimes the object creation doesn't fail and sometimes it does.</p>
  
  <p>So, for example, if I get the digital certificate of Google.com, I get as result the following array:</p>
  
  <pre><code>...
  "validFrom" =&gt; "151118151813Z"
  "validTo" =&gt; "160216000000Z"
  "validFrom_time_t" =&gt; 1447859893
  "validTo_time_t" =&gt; 1455580800
  ...
  </code></pre>
  
  <p>Those strings cause an error:</p>
  
  <blockquote>
    <p>DateTime::__construct(): Failed to parse time string (1474632000) at
    position 8 (0): Unexpected character</p>
  </blockquote>
  
  <p>I don't understand how to transform them into a <code>DateTime</code> object. What I'm doing wrong?</p>