Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not going to address the text file searching here. Let's say that eventually you get the start and end times together. Getting the difference between the two is pretty easy.</p> <p>(Of note, I think you have your times reversed. The times in the "end" file are always lower than the times in the "begin" file, and that's probably not right. Additionally, you seem to be storing the dates in DD/MM/YYYY format, which my examples <em>might</em> not parse correctly because it can be ambiguous for any day prior to the 13th. You may want to store them in YYYY-MM-DD format instead, which is completely unambiguous.)</p> <p>Here's way 1, using plain old unix timestamps.</p> <pre><code>// First we have our times in a human readable format. // Let's make them into unix timestamps $start_time = strtotime('01/07/2010 15:28'); $end_time = strtotime('01/07/2010 15:54'); $difference_in_seconds = $end_time - $start_time; // If you need the difference in minutes or hours, you'll need to // do the math yourself. echo "That turn took {$difference_in_seconds} seconds to complete."; </code></pre> <p>Here's way 2, using PHP's new <a href="http://us2.php.net/manual/en/class.datetime.php" rel="nofollow noreferrer">DateTime</a> and <a href="http://us2.php.net/manual/en/class.dateinterval.php" rel="nofollow noreferrer">DateInterval</a> classes. This will only work in PHP 5.3 or better.</p> <pre><code>// We have our times in human readable format. // Let's make them into DateTimes $start_time = new DateTime('01/07/2010 15:28'); $end_time = new DateTime('01/07/2010 15:54'); $interval = $end_time-&gt;diff($start_time, true); echo "That turn took " . $interval-&gt;format('%h hours, %i minutes and %s seconds.'); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload