title: DateTime conversion: "The timezone could not be found in the database"
body: <p>I'm trying to convert a DateTime that I'm receiving from an API.</p>
  
  <p>This is how their are generating the datetime string:</p>
  
  <pre><code>public static function formatDate($date) {
      $format = "Y-m-d\TH:i:sP";
      if ($date instanceof DateTime) {
          $d = $date-&gt;format($format);
      } elseif (is_numeric($date)) {
          $d = date($format, $date);
      } else {
          $d = (String) "$date";
      }
      return $d;
  }
  </code></pre>
  
  <p>Wich gives me </p>
  
  <pre><code> "2013-06-14T04:00:36.000-03:00"
  </code></pre>
  
  <p>And this is what I am doing to convert it back:</p>
  
  <pre><code>try 
  { 
     $date = Carbon\Carbon::createFromFormat("Y-m-d\TH:i:sP", "2013-06-14T04:00:36-03:00");
  
     echo "&lt;pre&gt;".var_dump($date)."&lt;/pre&gt;";
  
     $date = DateTime::createFromFormat("Y-m-d\TH:i:sP", "2013-06-14T04:00:36.000-03:00");
  
     echo "&lt;pre&gt;".var_dump($date)."&lt;/pre&gt;";
  
     $date = Carbon\Carbon::createFromFormat("Y-m-d\TH:i:sP", "2013-06-14T04:00:36.000-03:00"); /// raise exception
  
     echo "&lt;pre&gt;".var_dump($date)."&lt;/pre&gt;";
  } 
  catch(InvalidArgumentException $x) 
  { 
      echo $x-&gt;getMessage(); 
  }
  </code></pre>
  
  <p>DateTime class gives me just a null, no errors, but Carbon (<a href="https://github.com/briannesbitt/Carbon" rel="nofollow">https://github.com/briannesbitt/Carbon</a>) extended from DateTime tells me what's happening and this is the ouput:</p>
  
  <pre><code>object(Carbon\Carbon)#181 (3) { ["date"]=&gt; string(19) "2013-06-14 04:00:36" ["timezone_type"]=&gt; int(1) ["timezone"]=&gt; string(6) "-03:00" }
  
  bool(false)
  
  The timezone could not be found in the database
  </code></pre>
  
  <p>So, just dropping the ".000" from the datetime it works, but why, if it was created by PHP using the exact same format I'm using to convert it back?</p>