Closed baiyang closed 11 years ago
This happens if you set wrong time_zone. My Location is china, but torndb set time_zone = "0:00". After set time_zone "+8:00", It return right answer.
thx, I meet the same problem. and here is the init method:
def init(self, host, database, user=None, password=None, max_idle_time=7 * 3600, connect_timeout=0, time_zone="+0:00", charset = "utf8", sql_mode="TRADITIONAL"):
What's Your timezone in os? Is it +0:00?
my table's description below +---------------+-------------+------+-----+-------------------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------+-------------+------+-----+-------------------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | hash_info | varchar(45) | NO | UNI | NULL | | | found_torrent | int(11) | YES | | 0 | | | found_time | timestamp | NO | | CURRENT_TIMESTAMP | | +---------------+-------------+------+-----+-------------------+----------------+
My sql command is select count(*) as t from t_hash_info where date(found_time) = "2013-11-19";
I execute the same sql command both in mysql and with torndb get api, get different result. At the same time, I do again using MySQLdb original api, get right answer. I dont know why.