| Eric1776 2005-01-11, 3:59 pm |
| I wasn't sure if I should put this is a JavaScript issue or .NET issue.
Anyway, I have some javascript that shows time zones on the page. By
default, it wants to use the machines local time. We want it to use the
server time. So I'm assuming that we need some kind of server code to
do this.
So I put in a line of .NET that tells it the current server time. This
works except that the time no longer refreshes on its own like it did
before. I have to refresh the page to get the most current time.
Here is some of the code.
function GetTime()
{
var zuluTimeJS = "<% Response.Write(DateTime.UtcNow.ToString("ddd MMM
dd H:mm:ss 'GMT' yyyy")); %>";
var dt = new Date(zuluTimeJS);
var def = dt.getTimezoneOffset()/60;
var gmt = (dt.getHours() + def);
var ending = ":" + IfZero(dt.getMinutes());
var _GMT =check24(((gmt) > 24) ? ((gmt) - 24) : (gmt));
document.clock._GMT.value = (IfZero(_GMT) + ":" +
IfZero(dt.getMinutes()));
|