JSClock

Simple clock written in JS.

HTML

<div id="holder"></div>

CSS

div {
    text-align: center;
    font-size: 100px;
}

JavaScript

document.getElementsByTagName("div")[0].style.marginTop = $(document).height() / 3 + "px";

window.setInterval(function () {
    var time = "";
    var now = new Date();
    var hours = "" + now.getHours() + ":";
    var minutes = "" + now.getMinutes() + ":";
    var seconds = "" + now.getSeconds();
    var part;
    if (parseInt(hours) < 12) {
        part = " AM";
    } else {
        hours = parseInt(hours) - 12 + ":";
        part = " PM";
    }
    if (hours.length < 3) {
        hours = "0" + hours;
    }
    if (minutes.length < 3) {
        minutes = "0" + minutes;
    }
    if (seconds.length < 2) {
        seconds = "0" + seconds;
    }
    time += hours;
    time += minutes;
    time += seconds;
    time += part;
    $("#holder").html(time);
}, 1000);