John
John

Reputation: 10146

Setting timezone for MySQL

Im using php to set the current timezone for a site:

date_default_timezone_set('America/New_York');

How could I, at the same time, set the same time zone for mysql so that when I use NOW() it uses the timezone set in php?

Upvotes: 0

Views: 152

Answers (2)

marc_ferna
marc_ferna

Reputation: 5847

You can change your Mysql timezone using SET time_zone = timezone;

http://dev.mysql.com/doc/refman/5.1/en/time-zone-support.html

Upvotes: 1

InternetSeriousBusiness
InternetSeriousBusiness

Reputation: 2635

Don't.

The best practice is to store UTC in the database.

Upvotes: 3

Related Questions