title: PHP DateTime: Call to a member function format() on boolean
body: <p>I am trying to use the DateTime class to see if a certain time has passed or not. However when using the DateTime class it fails...</p>
  
  <p>This is my string which I get from my database:</p>
  
  <pre><code>$timeToCheck = $users[$i]["lastLoggedIn"] . " " . $users[$i]["lastTimeOn"];
  </code></pre>
  
  <p>An example for this would be: 2016-03-09 01:32:44</p>
  
  <p>Then I use the following:</p>
  
  <pre><code>$dbTimeStamp = date_create_from_format('Y-m-d H:i:s', $timeToCheck);
  
  $timeStamp = new DateTime($dbTimeStamp-&gt;format('Y-m-d H:i:s'));
  
  $timeLimit = $timeStamp-&gt;add(new DateInterval("PT24H"));
  
  $timeNow = new DateTime();
  </code></pre>
  
  <p>I receive the following error:  Call to a member function format() on boolean on <code>$timeStamp = new DateTime($dbTimeStamp-&gt;format('Y-m-d H:i:s'));</code></p>
  
  <p>The date format in the database is the same as the format I am trying to create and for example would be 2016-03-09 01:32:44</p>
  
  <p>I cannot see what I am doing wrong?</p>