I am creating a simple application on Electron.
I want to save the current timestamp of an input so that I can live calculate the elapsed time of a user. What I have in mind right now is a function that saves the timestamp of the input to be deducted from the current time clock of the application to get the current elapsed time of the user.
How do I go about creating the "save current time" function? This is what I have so far:
var now = new Date(); // time now
now.getHours(); //
now.getMinutes(); //
now.getSeconds(); //
for getting the current time, and:
var tableBody = '';
for (i = 0; i < students.length; i++) {
tableBody += '<tr>';
tableBody += ' <td style="text-transform:capitalize;">' +
students[i].name + '</td>';
tableBody += ' <td>' + now + '</td>';
tableBody += ' <td><input class="btn btn-danger" type="button"
value="Delete" onclick="deleteStudent(\'' + students[i]._id + '\')"></td>'
tableBody += '</tr>';
}
it's propagated here in a table with the "now" variable. However, it shows up as the current time as saved on my local computer, which isn't what I want.
I apologize if this is confusing, English is not my first language and I can further clarify any questions. Thank you. I've also attached a screenshot at the bottom to help explain what I'm trying to do.