Forums.ATC.no

Teknisk => Generelt teknisk => Emne startet av: ATC på 28. Mars 2009, 16:48 pm

Tittel: MySQL: datetime column uses correct timezone, NOW() does not
Skrevet av: ATC28. Mars 2009, 16:48 pm
When inserting data into a table that contains a 'datetime' type column, the timestamp is stored in the same timezone as the MySQL server is configured with.

Unfortunately, when trying to query the same table using timestamps based on the NOW() function, I get the incorrect data because NOW() always seems to return the present time in UTC. How can I fix this?
Tittel: [Solved] MySQL: datetime column uses correct timezone, NOW() does not
Skrevet av: ATC28. Mars 2009, 16:48 pm
Use the following MySQL-specific command:
SET SESSION time_zone = '+1:00'

+1:00 corresponds to CET, replace with your own timezone.

You may have to adjust for Daylight Saving Time, I really don't know...