I have the following script to show the time on my webpage
The highlighted code in red is what I had to use to debug the time.
For every hour, minute, and second. If the number was below 10 it would show as 1,2,3,4 etc, instead of 01,02,03
Is this a bug in the time or where they not thinking when they made it...
---------------------------------------
Thanks for your help,
Jon
Code:
function show_time() {
var todays_date = new Date(); // gets current time and date
var get_month = todays_date.getMonth();
var month_string = month[get_month]; // Month in a string
var get_dom = todays_date.getDate();
var dom_string = day_of_month[get_dom]; // Day of month in a string
var get_day = todays_date.getDay();
var day_string = day[get_day]; // Day of week in a string
var hours = todays_date.getHours();
var minutes = todays_date.getMinutes();
var seconds = todays_date.getSeconds();
[COLOR=red]
if(hours < 10) {
hours = "0" + todays_date.getHours();
}
if(minutes < 10) {
minutes = "0" + todays_date.getMinutes();
}
if(seconds < 10) {
seconds = "0" + todays_date.getSeconds();
}
[/color]
document.getElementById('show_date').innerHTML = dom_string + " " + month_string + " / " + hours + ":" + minutes + " " + seconds;
setTimeout("show_time()",1000);
}
The highlighted code in red is what I had to use to debug the time.
For every hour, minute, and second. If the number was below 10 it would show as 1,2,3,4 etc, instead of 01,02,03
Is this a bug in the time or where they not thinking when they made it...
---------------------------------------
Thanks for your help,
Jon