corporate win--their requirements
Gervase Markham
gerv at mozilla.org
Sat Sep 28 21:27:39 UTC 2002
>> Maybe (probably) I'm missing something here. If you can provide some
>> JS that turns 1000001234 (server side secs-since-Jan-1970 value) to a
>> client-side 2002-03-03 11:43 , I'll be pleased and impressed.
>
> var d = new Date(1017859380000);
> var mar32k2 = d.getFullYear() + "-" + d.getMonth() + "-" + d.getDay();
Not necessarily, if the server is already on a different day from the
client. Remember, d is an object representing a server time.
Also, getMonth requires 1 adding to it, and zero-padding, and you mean
getDate(), not getDay(), and that needs zero-padding, too.
> var elevenFortyThree = d.toLocaleTimeString(); // 11:43:00 AM
toLocaleTimeString is JS 1.5, available on IE 5.5 and Netscape 6 and
above only.
Does toLocaleTimeString automatically add on the relevant delta for the
user's time zone compared to GMT? That would be wrong anyway, because we
need to modify the date based on the time zone difference between the
_server_ and the client, because dates are going to continue to be
stored on the server in the server's time zone. (Converting to GMT would
be a backwards-compatibility nightmare, and more complicated for admins.)
(Also, there's the problems I raised about not having JS, which you
could comment on at the bottom of this mail for simplicity, if you like.)
Gerv
More information about the developers
mailing list