I have an element containing time from event's timestamp. The time is from today. I also have current time with PHP:
$current_time = date('H:i');
It produces the following output: 22:48 but I can convert it to any other format if needed.
I would like to have a simple counter that will show how much time passed since the even took place and the current time and update #timePassed container every minute. The code looks something like this:
<div id="t1">
Finish: <em>4:05 PM</em> (<span id="timePassed">1 h 25 min</span>)
</div>
I feel that once I figure out how to substract time, I can use jQuery to calculate the time difference and update the container. Something like this:
var time_event = $('#t1 em').text(),
time_now = '.$current_time.',
time_pass = time_now - time_event;
setInterval(function () {
$('#timePassed').text();
}, 60000);
This is just an idea. There's too much still missing...