title: Failed to parse time string in PHP
body: <p>I need to create a DateTime from the value received from a form. The problem is that the value is received like a string: "2016-10-10T08:29:06.959Z" and I need to received like <code>2016-10-10T08:29:06.959Z</code> without quotes, because if I receive with quotes I've got the next error:</p>
  
  <blockquote>
    <p>DateTime::__construct(): Failed to parse time string (&quot;2016-10-14T22:00:00.000Z&quot;) at position 0 (&quot;): Unexpected character</p>
  </blockquote>
  
  <p>When I try to transform the value to a DateTime with:</p>
  
  <pre><code>$fechaHasta = new DateTime($params["fechaHasta"]);
  </code></pre>
  
  <p>If I try to use:</p>
  
  <pre><code>$fecha2 = DateTime::createFromFormat("d-m-Y H:i:s", $data["fechaHasta"]);
  </code></pre>
  
  <p>I've got an empty object in $fecha2.</p>
  
  <p>The form from where I send the data is:</p>
  
  <pre><code>&lt;form id = "formSearch" class = "menu-table" method = "post" action = "&lt;?php echo $this-&gt;basePath('/privado/actividades-planificadas/pai/exportdatatoexcel'); ?&gt;"&gt;
      &lt;input type = "hidden" name = "codigoPPM" value = "{{searchForm.codigoPPM}}" /&gt;
      &lt;input type = "hidden" name = "fechaDesde" value = {{searchForm.dt1}} /&gt;
      &lt;input type = "hidden" name = "fechaHasta" value = {{searchForm.dt2}} /&gt;
      &lt;input type = "hidden" name = "estado" value = "{{searchForm.estadoSelected.id}}" /&gt;
      &lt;button type = "submit"&gt;
          Exportar datos a Excel&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;img title = "Exportar tabla a Excel" src = "/img/logo-excel.png" /&gt;
      &lt;/button&gt;
  &lt;/form&gt; 
  </code></pre>
  
  <p>So, what I have to do to send the value without quotes or transform the value received in DateTime. </p>