What I want to do:
I want to change the current time again and display them in different rows of the table in my HTML document.
Example:
I want to get the time that was 10, 20, 60 and 71 minutes ago from the current time. So if the current time on my computer is 23:00 (in Europe) now, it should give me 22:50, 22:40, 22:00 and 21:49.
What i have done so far:
I managed to change the time once, but I'm not sure how to change it several times (perhaps using the "for" or "at that time" -Loop?) And add them all to the table in my html-document.
This is my .js:
window.setInterval("showpasttime()", 1000);
function showpasttime()
{
d = new Date ();
d.setMinutes(d.getMinutes()-10);
month = d.getMonth () + 1;
h = (d.getHours () < 10 ? '0' + d.getHours () : d.getHours ());
m = (d.getMinutes () < 10 ? '0' + d.getMinutes () : d.getMinutes ());
document.getElementById("row2").innerHTML = '10 minutes ago it was '
+ d.getDate () + '.'
+ month + '.'
+ d.getFullYear () +
' - '
+ h + ':' + m ;
};
Result:
In my html document "10 minutes ago it was 5.3.2014 - 22:50" is included in tablerow with id = "row2".
Problem / Question:
(, , 20, 60 71 ). , . "" ""?
( , , html/css/javascript/jquery).