I was asked to create a clock with timing and date event.... i want the function create a clock with timing and event and post the value together.I want the clock with timing and date event to be like this below.
My requirement is to create a clock with timing and date event. The time must change continuously.The date must change as well. If I run the html website today at 23:59:59, then the date must change to tommorow. Don't need to change the timezone just add the label SGT..Post the clock with timing and date event next to the local time. Here is my code below....
<html>
<head>
<title>Clock with a timing event</title>
<script type="text/javascript">
function startTime() {
var today = new Date();
var h = today.getHours();
var m = today.getMinutes();
var s = today.getSeconds();
m = checkTime(m);
s = checkTime(s);
document.getElementById('txt').innerHTML =
h + ":" + m + ":" + s;
var t = setTimeout(startTime, 500);
}
function checkTime(i) {
if (i < 10) {i = "0" + i}; // add zero in front of numbers < 10
return i;
}
</head>
<body>
<table border="1">
<tr>
<td>
Local Time
</td>
<td>
values
<td>
</tr>
</body>
</html>