from:http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html
SET GLOBAL time_zone = timezone;
from:http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_utc-timestamp
* UTC_TIMESTAMP, UTC_TIMESTAMP()
I have the same results, according to the docs timezone is the offset to UTC (what is used
internaly of cause).
see also:
http://www.mysqlfaqs.net/mysql-faqs/General-Questions/How-to-manage-Time-Zone-in-MySQL
btw: please notice the difference between:
mysql> select @@session.time_zone ;
+---------------------+
| @@session.time_zone |
+---------------------+
| +00:00 |
+---------------------+
1 row in set (0.00 sec)
mysql> select @@global.time_zone ;
+--------------------+
| @@global.time_zone |
+--------------------+
| SYSTEM |
+--------------------+
1 row in set (0.00 sec)
ntl personally i would say it should work with "UTC" but someone decided otherwise.
(i just found a hint why: http://dev.mysql.com/doc/refman/4.1/en/mysql-tzinfo-to-sql.html
)
hope that helps,
wh
Am 21.06.2011 00:00, schrieb sono-io@stripped:
> On Jun 20, 2011, at 10:11 AM, Jerry Schwartz wrote:
>
>>> You should use UTC time zone or you will run into trouble with DST.
>>>
>> [JS] If you do that, you can't use an automatic timestamp field. You have to
>> set the field yourself.
>
> Thanks Walter and Jerry.
>
> Is there a way to get NOW() to use UTC instead of the server timezone? (The server
> is not mine, so I can't change the my.cnf.) Here's my statement:
>
> SELECT * FROM `log` WHERE `id` = $_id AND ( `time_stamp` >= DATE_SUB(NOW(),
> INTERVAL 30 MINUTE) )
>
> Earlier in my PHP script I've used date_default_timezone_set, but that doesn't
> affect the MySQL statement.
>
> ------
>
> Possible Solution
>
> I tried: SET time_zone = 'UTC';
> but MySQL complained with: #1298 - Unknown or incorrect time zone: 'UTC'
>
> I then tried:
> SET time_zone = '-0:00';
> and that seems to have worked. Is this the correct way to do it?
>
> Thanks,
> Marc