How do I set a MysQL variable (time_zone) from within doctrine / symfony?

TendCorne

New Member
I would like to know how I can set the MySQL time zone to UTC (\[code\]SET time_zone = 'UTC'\[/code\]) from within Symfony/Doctrine, so when I call a \[code\]UNIX_TIMESTAMP()\[/code\] function on a \[code\]DATETIME\[/code\] field in my query, it returns the UTC unix time and not unix time in the server's time zone. How can I do this, either automatically upon every connection, or manually before these types of queries where the timezone makes a difference?BTW, I need to do this conversion within the MySQL query and not the app so I can \[code\]GROUP BY\[/code\] an interval that requires epoch time.
 
Back
Top