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
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=arch...@jab.org

Reply via email to