
77
36
|
on one server,when I run:
on another server:
|
118
|
I thought this might be useful
There are 3 places where the timezone might be set in MySQL:in the file "my.cnf" in the [mysqld] section
@@global.time_zone variable
To see what value they are set to
To set a value for it use either one:
@@session.time_zone variable
To set it use either one:
both might return SYSTEM which means that they use the timezone set in my.cnf. For timezone names to work you must setup your timezone information tables need to be populated:http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html
To get the current timezone
It will return 02:00:00 if your timezone is +2:00.
To get the current UNIX timestamp:
To get the timestamp column as a UNIX timestamp
To get a UTC datetime column as a UNIX timestamp
Note: Changing the timezone will not change the stored datetime or timestamp, but it will show select a different datetime from timestamp columns
I made a cheatsheet here: Should MySQL have its timezone set to UTC?
|
No comments:
Post a Comment