What is Java Script Clock ?
One of the great things about JavaScript is that it lets you manipulate the contents of a Web page in real-time. This means that we can use JavaScript to create a digital clock, embedded in the Web page, that updates every second. This article shows you how to do just that.
 How To Work Script Clock ?
If we want to create a clock then obviously we need to retrieve the current time. We can do this via JavaScript's Date class. First, we create a new Date object with no parameters, which gives us a Date object containing the current date and time on the visitor's computer:

<!--script code start -->
function date_time(id)
        date = new Date;
        year = date.getFullYear();
        month = date.getMonth();
        months = new Array('January', 'February', 'March', 'April', 'May', 'June', 'Jully', 'August', 'September', 'October', 'November', 'December');
        d = date.getDate();
        day = date.getDay();
        days = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
        h = date.getHours();
                h = "0"+h;
        m = date.getMinutes();
                m = "0"+m;
        s = date.getSeconds();
                s = "0"+s;
        result = ''+days[day]+' '+months[month]+' '+d+' '+year+' '+h+':'+m+':'+s;
        document.getElementById(id).innerHTML = result;
        return true;
<!--script code end-->
        <div style="background:white; width: 330px; text-align: center; border-radius: 2px;">
        Today is
        <script type="text/javascript" src="date_time.js"></script>
            <span id="date_time"></span>
            <script type="text/javascript">window.onload = date_time('date_time');</script>O'clock
<!--html code end -->