JRS: In article <3F24DD4E.60404 (AT) t-online (DOT) de>, seen in
news:comp.lang.javascript, Martin Honnen <Martin.Honnen (AT) t-online (DOT) de>
posted at Mon, 28 Jul 2003 10:22:38 :-
Quote:
sevim ozsahin wrote:
I have a msacees 2000 mdb file sitting on the server and client mdb's
are linked to that server mdb.
I would like to have single system date and time for accurate data
entry. I will be very happy if you can tell me how can I set client date
and time to server's via code.
JavaScript executed in an HTML page loaded in a browser cannot set the
system date. |
Which is true, but which is not all that might be said; however, the
following is untested.
A server can serve a page with the server's date/time written in it,
perhaps as <script> var Now = 1234567890e3 ; </script> (for 2009-02-13
Fri 23:31:30 GMT).
Further script on the page can determine the client time of receipt of
the page, and hence the correction to be applied to the client clock to
make it agree with the server - <script> var Corr = Now - new Date() ;
</script> ; or can maintain a scripted clock showing server time. There
will be a small error due to propagation delay.
When the client page returns data to the server, it can also return the
client system time, perhaps with that correction. The server, on
receipt, can look at its own time.
The total discrepancy will be the forwards + return propagation times,
plus the contribution from client rate error. If client rate error can
be assumed unimportant, then the times recorded by the client can in
fact be corrected to server time by ascribing half the difference to
each propagation delay.
So, although the server time cannot be applied to the client's actual
system clock, it can be applied to a clock on the client page running at
the client system clock rate.
If propagation delay can be assumed unimportant, the client, having
written date/times in its data, can write as more data the current
date/time on the same scale; the server can use the latter to adjust the
former.
Critical Date Friday 13th - only 1901-12-13 (UNIX signed 2^31s), the
above, and 4772-10-13 (completion of Mayan Great Cycle).
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 MIME. ©
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.