title: PHP check if two Datetimes are not on the same calendar day
body: <p>I have two Datetimes like this (the dates being actually $vars)</p>
  
  <pre><code>$startTime = \DateTime::createFromFormat('Y/m/d H:i', '2015/01/01 23:00');
  $endTime = \DateTime::createFromFormat('Y/m/d H:i', '2015/01/02 01:00');
  </code></pre>
  
  <p>I struggle with a (possibly pretty) simple problem: How could I determine if the two dates are on different calendar days?</p>
  
  <p>I cannot do <code>&lt;</code> as <code>2015/01/01 22:00 &lt; 2015/01/01 23:00</code> would also be true. I can also not do this:</p>
  
  <pre><code>$diff = $startTime-&gt;diff($endTime);
  $days = $diff-&gt;format('%d');
  
  echo $days;
  </code></pre>
  
  <p>as it gives me <code>0</code>.</p>
  
  <p><a href="https://stackoverflow.com/questions/12802722/how-to-check-if-two-dates-not-on-the-same-calendar-day">THIS</a> gives me an idea about how to do it, but for javascript, what would be the equivalent for php?</p>
  
  <p>//UPDATE</p>
  
  <pre><code>    $startDate = $startTime-&gt;format('Y/m/d');
      $endDate = $endTime-&gt;format('Y/m/d');
      $diffDates = $startDate-&gt;diff($endDate);
      $daysDiff = $diffDates-&gt;format('%d');
  
      echo $daysDiff;
  </code></pre>
  
  <p>I think that might be the right approach now, thanks to the comments, but now I get <code>Error: Call to a member function diff() on string</code></p>
  
  <p>//UPDATE FOR CLARIFICATION WHAT I'M TRYING TO DO</p>
  
  <p>I just want to have the difference in days, so for the above it would be <code>'1'</code> (although only 2 hours difference actually) and for example <code>'2015/01/01 23:00' and '2015/01/03 17:00'</code> would be <code>'2'</code>.</p>