So I have web watch what should work 24/7. It displaying digital time and current day. Nothing else. 

My problem is that when time past midnight, current day won't update and I need to restart whole application.

I tried to add setTimeout for showDate() function, but it didn't help me. I was thinking about moving +1 on array of days. Is there anything more effective?

```
function showdate(){

    var date = new Date();
    var day = date.getDay();

    var name = ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][day];

    document.getElementById("date").textContent = name;

}

showdate();

function showTime(){
    var date = new Date();
    var h = date.getHours(); // 0 - 23
    var m = date.getMinutes(); // 0 - 59
    var s = date.getSeconds(); // 0 - 59
    var session = "AM";

    if(h === 0){
        h = 24;
    }

    /*if(h > 12){
        h = h - 12;
        session = "PM";
    }*/

    h = (h < 10) ? "0" + h : h;
    m = (m < 10) ? "0" + m : m;
    s = (s < 10) ? "0" + s : s;

    var time = h + ":" + m + ":" + s;
    /*var sess = session;*/
    document.getElementById("MyClockDisplay").innerText = time;
    document.getElementById("MyClockDisplay").textContent = time;
   /* document.getElementById("PM").textContent = sess;*/

    setTimeout(showTime, 1000);     

   }

showTime();

```

Thank you for any idea.