title: Calculating time differences in minutes (PHP)
body: <p>I want to set a timer and calculate how long it takes to do a task.</p>
  
  <p>So I have the following PHP code set up just to test: </p>
  
  <pre><code>$firstDate = date('Y-m-d h:m:s');
  sleep(80);
  $secondDate = date('Y-m-d h:m:s');
  $diffDates = (strtotime($secondDate) - strtotime($firstDate));
  
  echo "Difference in dates is:" . $diffDates . "\n";
  </code></pre>
  
  <p>When I run it though it gives me the following output:</p>
  
  <pre><code>    Difference in dates is:-40
  </code></pre>
  
  <p>What I'm wondering is, why does it give me -40, and how can I set it up so that I can just do a simple calculation of ending date - starting date in minutes.</p>
  
  <p>Your help is greatly appreciated.</p>