So you do this ...
"set time_zone = '-5:00'"
How do you handle daylight savings time?
So you do this ...
"set time_zone = '-5:00'"
How do you handle daylight savings time?
The scripts I have seen, have a checkbox which adjusts the script settings/clock by one hour when it is checked, or not checked respectively. But really, if PHP is using the server time then the time should always be right since that clock is updated by rdate.
As for MySQL, I have no idea, if anyone finds it, I'd be interested in it for a script I am working on as well.
Last edited by Matt; 03-13-2008 at 08:05 PM.
Send your friends and site visitors to GlowHost and get $125 plus bonus!
GlowHost Affiliate Program | Read our Blog | Follow us on X |
After discussing this further off-line, I have come to the conclusion that I believe it would always be best to handle any recording of time into MySQL as GMT. Then to simply let PHP handle the displaying of time into your intended time zone.
This would allow you to change the time zone domain wide by using the Apache directive. Then as Matt has pointed out and you have visitors that require the time to be displayed differently, you can override the default time zone set by Apache with PHP.
As Mysql is concerned you can then make the adjustment on a per connection basis by setting the time zone to "0".
I believe this would also aide in making your code more portable.
This is my conclusion, any other thoughts or holes in my train of thought here?
I think I too have heard that the way to do it is in fact, GMT. It does ring a bell anyways.
The only portability problem I see is that not everyone uses Apache webserver.
I suppose it would not much matter for you unless you plan on making this application for sale or distribution, and then, I still wonder. I think the more you can keep out of .htaccess the better though, because different web servers either do not read that file, or may interpret it differently than Apache does.
Why not let PHP do all the time processing based on GMT in MySQL?
Last edited by Matt; 03-14-2008 at 10:29 AM.
Send your friends and site visitors to GlowHost and get $125 plus bonus!
GlowHost Affiliate Program | Read our Blog | Follow us on X |