Hello.
I am trying to create a javascript date/time script to display the current GMT date, but obviously because javasceipt is client side it displays the clients current date not the GMT date.
Does anyone know how i can get javascript to show the current GMT date to anyone (even people not in the GMT timezone).
Here is my script as it stands now;
function Time()
{
var d = new Date();
var seconds1 = d.getSeconds();
if(seconds1 < 10) {
var seconds = "0" + d.getSeconds();
} else {
var seconds = d.getSeconds();
}
var mins1 = d.getMinutes();
if(mins1 < 10) {
var mins = "0" + d.getMinutes();
} else {
var mins = d.getMinutes();
}
var hours1 = d.getHours();
if(hours1 < 10) {
var hours = "0" + d.getHours();
} else {
var hours = d.getHours();
}
var day1 = d.getDate();
if(day1 < 10) {
var day = "0" + d.getDate();
} else {
var day = d.getDate();
}
var weekday=new Array("Sun", "Mon", "Tue", "Wed", "Thur", "Fri", "Sat");
var month=new Array("Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec");
document.getElementById("TimeUpdate").innerHTML= weekday[d.getDay()] + ", " + day + " " + month[d.getMonth()] + " " + d.getFullYear() + " - " + hours + ":" + mins + ":" + seconds + " GMT";
setTimeout("Time()",1000);
}
setTimeout("Time()",10);