title: Get the difference between form $_POST date to new date
body: <p>I want to get the difference between $_POST time and the time generated within the page after submit.</p>
  
  <p>As I want to do an if statement which would be if the difference between the two times is less than 5seconds then ... else ...</p>
  
  <p>Is using php date("H:i:s); the correct function?</p>
  
  <p>Generate time</p>
  
  <pre><code>&lt;?php date = date("H:i:s"); ?&gt;
  </code></pre>
  
  <p>Echo time in hidden form field</p>
  
  <pre><code>&lt;input name="tstmp" type="hidden" value="&lt;?php echo $date; ?&gt;"/&gt;
  </code></pre>
  
  <p>Then in the page that the user get's directed to after form submit.</p>
  
  <pre><code>//could the problem be this is a string within the $_POST
  $timestart = $_POST['tstmp'];
  
  $timeend = date("H:i:s");
  
  //can this only be used with timestamp?
  $interval = $timestart-&gt;diff($timeend);
  </code></pre>