title: Fatal error: Call to undefined method DateTime::createfromformat()
body: <p>How do you solve the error of:</p>
  
  <pre><code>Fatal error: Call to undefined method DateTime::createfromformat()
  </code></pre>
  
  <p>The error is happening at line 35. This is what my code reads from line 31 to 45</p>
  
  <pre><code>// check database for necessary updates
  
  $update = mysql_query("SELECT * FROM rent WHERE colour='#3C0'");
  while($row_update = mysql_fetch_array( $update )) {
      $datetime_lower   = DateTime::createFromFormat('d/m/Y', $min);
      $datetime_upper   = DateTime::createFromFormat('d/m/Y', $max);
      $datetime_compare = DateTime::createFromFormat('d/m/Y g:i a', $row_update['pDate']);
      if ($datetime_lower &lt; $datetime_compare &amp;&amp; $datetime_upper &gt; $datetime_compare) {
          // date is between do nothing
      } else {
          // date is not between so update
          $update_result = mysql_query("UPDATE rent SET colour='#F0F0F0' WHERE id=" . $row_update['id'] . " &amp;&amp; colour='#3C0'");
          mysql_close($update_result);
      }
  }
  </code></pre>
  
  <p>How can I resolve this?</p>