Re: Wrong time being displayed by PHP!
| From: | Lester Caine | Date: | Wed, 17 Oct 2012 09:53:28 +0000 |
| Subject: | Re: Wrong time being displayed by PHP! | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-319497@lists.php.net to get a copy of this message | ||
Daniel Brown wrote:
Managing 'time' is an ongoing problem simply because some of the essential tools are missing. While the browser only returns a current time offset rather than a time zone, one has no idea of a user's real local time? One of the preferred methods of working where a server is being accessed from several timezones is that the server should run at UTC and any data stored should then be UTC as well. Then we have problem when displaying for a time only using the browser information, since next month the time may be an hour different? So we have to work with some user supplied timezone which will also add the DST information. If you only want a single 'timezone' ever, then UTC still makes prefect sense since nothing will be changing the offsets, and you just say 'local' :) -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.ukThis is the output:America/Los_Angeles Tue, 16 Oct 2012 17:22:09 -0400 Tue, 16 Oct 2012 21:22:09 +0000 1350422529 (-14400) Tue Oct 16 17:22:09 EDT 2012Is this a shared server, Rich? As shown, the admin configured thetimezone of the machine to be EDT and set the clock right, but php.ini must be set to PDT. You can easily override this with a local php.ini file, an .htaccess directive, or by placing date_default_timezone_set() near the top of the code.