Reputation: 349
I am trying to get all the votes from TODAY THE CURRENT , and I have almost achieved that with the following mysql query, but there's one problem.
This code gets me the votes from today:
SELECT COUNT(*) FROM votes WHERE `when` > CURRENT_DATE
but when inserting into mysql using now()
the now() is 1 hour behind my timezone (Europe/London) how can I fix that?
Thanks.
Upvotes: 2
Views: 2570
Reputation: 5115
You will need to populate your timezone tables. If you are on linux, you can do so by running the following command :
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql
You may need to know your root password. You then can run the following query as root :
SET GLOBAL time_zone = 'Europe/London';
Upvotes: 2
Reputation: 455
mysql> SET GLOBAL time_zone = 'America/New_York';
https://dev.mysql.com/doc/refman/5.5/en/time-zone-support.html
Upvotes: 0