Do you have a question? Post it now! No Registration Necessary. Now with pictures!
July 16, 2004, 3:49 pm
rate this thread
all here is some server info:
Time is set to GMT
My goal is to be able to accurately record website visits according to
my local time (U.S. Central) every day of the year, no matter if I am
in DST or not. I need a full datetime set of information (hour, min,
I have devised this line of code...
....but it does not help me when DST changes for me, as GMT does not
Next I tried this:
echo("server time is: " . date("H:i:s") . "<br>\n");
echo("new server time is: " . date("H:i:s") . "<br>\n");
And got these results:
server time is: 17:46:44
new server time is: 17:46:44
Apparently, the server does not allow me to change my timezone to
Central time (because the resulting times are the same). The
application I am developing relies heavily on *accurate* time
information. Anyone have any ideas how I can get this DST issue
Re: Daylight Savings Time
Then you *ALSO* need to be able to record whether or not DST was in
effect at the time or not. Otherwise, there will be two GMT timestamps
that translate to the SAME Central timestamp (one CST, one CDT, and
that's the only thing different about them).
Have you tried it? UNIX time stamps are stored in GMT. The presentation
of the time information is handled when you convert it to printable form.
I recommend that you also print the time zone in the above example.
I doubt it has changed. I don't see any doc that says you can
change the output of date() by changing TZ with putenv(), and worse,
I don't see any doc that says that changing TZ with putenv() will
not affect threads other than yours (for example, the Apache server
logs) for longer than your script runs.
There is some evidence on the PHP site in the commented version of
the putenv function page that it does, on at least one implementation,
affect the Apache logs when you change TZ. There is also a suggestion
that if you invoke mktime(0,0,0,1,1,1970) after doing a putenv()
on the TZ environment variable, the change will take for your
program. I have not tested this.
In the C world, I think there are some implementations where once
you call localtime(), changing TZ further will not change the time
zone localtime() returns unless you call some other function not
available in PHP (tzset()).
If you really want accurate time information, I suggest storing it
Gordon L. Burditt