title: Call to a member function modify() on a non-object
body: <p>So I'm trying to check if the reset link is expired. Here's what I got </p>
  
  <pre><code>//Get token data
  $stmt = $con-&gt;prepare("SELECT token_created_at from reset WHERE token = :urltoken");
  $stmt-&gt;bindValue(':urltoken', htmlspecialchars($_GET['token'], ENT_QUOTES, 'UTF-8'));
  $stmt-&gt;execute();
  $stmt-&gt;setFetchMode(PDO::FETCH_ASSOC);
  while($row = $stmt-&gt;fetch()) {
       $token_created_at = $row['token_created_at'];
  }
  
  $token_created_at;
  
  //Return current time to match
  $current_time = new DateTime(); 
  
  $my_dt = DateTime::createFromFormat('m-d-Y H:i:s', $token_created_at);
  
  //Modify error
  $expires_at = $my_dt-&gt;modify('+1 hour');
  </code></pre>
  
  <p>And how I set the date when the user asks for a reset </p>
  
  <pre><code>//Get creation time 
  $time_gen = date('m-d-Y H:i:s', time());
  </code></pre>
  
  <p>Now what happens is I get </p>
  
  <blockquote>
    <p>Fatal error:  Call to a member function modify() on a non-object  in /Users/MATT/Desktop/Learn/forgot/activate.php on line 26</p>
  </blockquote>
  
  <p>Line 26 being </p>
  
  <pre><code>$expires_at = $my_dt-&gt;modify('+1 hour');
  </code></pre>
  
  <p>Any ideas? I've tried other posts, but they don't seem to apply to my issue. They're also stored as <code>VARCHAR</code></p>