I am from Poland and I want to have UTC 1:00 time on my website. Is this possible to set it ones, insted of changing every piece of php code?
When I put mysql record with now() function I also mean UTC 1:00. How to configure it?
You can set it by adding date.timezone = Etc/GMT 1 to your php.ini
You’ll need to create a custom php.ini if you haven’t already.
Bear in mind that if you use MySQL’s TIMESTAMP, it will be entered as the server time. I don’t believe there is any way to override this, other than relying on your custom php.ini and now().
That’s suppposed to be Etc/GMT+1 but the + didn’t show.
Thanks sXi, date.timezone works fine for php, but not for mysql.
In phpmyadmin ‘server variables and settings’ is said: “time zone SYSTEM”.
I can’t change it. I found something about it at http://dev.mysql.com/doc/refman/5.1/en/timezone-problems.html, but it requires root permissions.
As per my previous response, you’re stuck with the mysql thing and will probably need to rely on date/time insertions and queries by using the php date() and now() functions.
Thanks. That’s what I’m gonna do.
it would be a bit more straightforward if you use gmdate() instead of date() as gmdate() will output the time/date in UTC timezone with no need to convert it.
Then you can mimic the mysql’s NOW() with by having gmdate produce an output in the same format and then inserting that
a bit rought, but it may work