I have looked here but this couldn't solve my task.
Question on hand is:
I have a date in an event.date
col in my MySQL DB which is being retrieved like this:
app.get('/', (req, res) => {
var query1='SELECT event_date,... FROM event..';
connection.query(query1, function(err,results){
if (results) res.render('index', {data: results});
});
});
What I want is to start a timer on my page which will take the diff between new Date();
and my stored date (like this)
index.ejs
<% data.some(function(d,index){ %>
<%= d.event_date %> //this prints the data here obviously
<% **How to implement the setInterval() here??** %>
<% })%>
I tried two or more noob ways but all in vain. What concept am I missing? How to achieve this?
Thanks.