I created a clock to be placed in the header of my website. The time is not displaying a zero for minutes < 10. For example if the time is 10:50, it will only show 10:5 ,I found a solution but unsure of how to implement it. Also if there is a better method please share.
var current;
window.onload = function () {
current = new Date();
document.getElementById("clock").innerHTML = current.getHours() + ":" + current.getMinutes();
This is what I need
if (minutes < 10)
minutes = "0" + minutes
and this is the container for my clock
<span id="clock"> </span>