Hello everybody,
First off let me say I did do a search of google and these forums before posting this. I have sort of what I want without having exactly what I want and before I proceed further hacking up already working code I figured I'd start a conversation as to whether my goal is at all possible.
Currently using (thank you w3schools as I am by no means a javascript expert):
document.writeln(new Date())
I get the following: Wed Jul 13 2011 09:24:09 GMT-0600 (Mountain Daylight Time)
which would be great for most people, but I'm kind of picky so I want the clock to keep ticking and to show the current time.
To do this I use this code(again thank you w3schools):
function startTime()
{
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
// add a zero in front of numbers<10
m=checkTime(m);
s=checkTime(s);
document.getElementById('txt').innerHTML=h+":"+m+":"+s;
t=setTimeout('startTime()',500);
}
function checkTime(i)
{
if (i<10)
{
i="0" + i;
}
return i;
}
This displays: 09:24:09.
Now for the question is it possible to hack up the
document.writeln(new Date())
to display as follows:
09:24:09 (Mountain Daylight Time)
with the time being that of my clock? Or am I going to be forced to learn javascript and create my own script that gets the time, checks the timezone and converts it to MST for example?
Also while we are on the topic of formatting can that Mountain Daylight Time be formatted to be MDT/MST?