I pulling date from Database. Time Ago is working fine but its not update time
<abbr class="timer timeago modified"><?php echo date('Y-m-d H:i:s', strtotime($row['project_create_date'])); ?></abbr>
JQuery
$(function() {
/*Time Ago*/
prepareDynamicDates();
var time = '';
$('.timer').each(function(){
var time = $(this).text();
$(this).text(jQuery.timeago(time));
});
});
First of all you need to use a
dataparameter to store the reference date. Usingtextwill get overwritten on the first instantiation.Then you can use
setIntervalto update the text as needed:Example fiddle
Note this updates every second which may cause poor performance in some browsers. I’d have thought refreshing every 30 seconds to 1 minute should be sufficient for what you need.