[Tutor] get local time ????

Jeff Shannon jeff@ccvcorp.com
Mon, 29 Jul 2002 10:08:56 -0700


runsun wrote:

> How can I get the time -- as my local time -- when a
> visitor visits my far-away website ???

I'm not sure of the specifics of your situation, as far as where your
code is running, etc, but ISTM that the solution to your problem is to
use UTC time (formerly/aslo known as GMT) as a baseline.  When your
(distant) webserver logs a timestamp, convert its local time to UTC.
When you view the logs on your machine, convert from UTC to your local
time.  If you always store all of your times as UTC, then it's fairly
simple to convert that to the appropriate local time for any location
(as long as you know the time zone ;) ).

I still have not done any significant web programming, so I can't help
you with logging of page visits, but I'm sure it can be done.

Jeff Shannon
Technician/Programmer
Credit International