{"action":"created","issue":{"url":"https://api.github.com/repos/go-sql-driver/mysql/issues/203","repository_url":"https://api.github.com/repos/go-sql-driver/mysql","labels_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/203/labels{/name}","comments_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/203/comments","events_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/203/events","html_url":"https://github.com/go-sql-driver/mysql/issues/203","id":25003657,"number":203,"title":"datetime timezone bug","user":{"login":"slene","id":653711,"avatar_url":"https://avatars.githubusercontent.com/u/653711?v=3","gravatar_id":"","url":"https://api.github.com/users/slene","html_url":"https://github.com/slene","followers_url":"https://api.github.com/users/slene/followers","following_url":"https://api.github.com/users/slene/following{/other_user}","gists_url":"https://api.github.com/users/slene/gists{/gist_id}","starred_url":"https://api.github.com/users/slene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slene/subscriptions","organizations_url":"https://api.github.com/users/slene/orgs","repos_url":"https://api.github.com/users/slene/repos","events_url":"https://api.github.com/users/slene/events{/privacy}","received_events_url":"https://api.github.com/users/slene/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2014-01-03T07:02:18Z","updated_at":"2016-07-18T07:39:22Z","closed_at":"2014-01-09T02:20:11Z","body":"Go-MySQL-Driver version 1.0.3\r\ngo version go1.2 linux/amd64\r\n\r\nBefore version 1.0.3 (included) everything is ok. But after this version. Has a timezone bug.\r\n\r\nexample:\r\n\r\nIn linux:\r\n\r\n    # date\r\n    Fri Jan  3 14:49:44 CST 2014\r\n\r\nIn Mysql 5.5\r\n\r\n```\r\nmysql> show variables like '%time_zone%';\r\n+------------------+--------+\r\n| Variable_name    | Value  |\r\n+------------------+--------+\r\n| system_time_zone | CST    |\r\n| time_zone        | SYSTEM |\r\n+------------------+--------+\r\nmysql> SELECT @@session.time_zone;\r\n+---------------------+\r\n| @@session.time_zone |\r\n+---------------------+\r\n| SYSTEM              |\r\n+---------------------+\r\nmysql> select now();\r\n+---------------------+\r\n| now()               |\r\n+---------------------+\r\n| 2014-01-03 14:50:10 |\r\n+---------------------+\r\n```\r\n\r\nIn go\r\n\r\n```go\r\ndb, _ := sql.Open(\"mysql\", \"root:root@/orm_test?charset=utf8\")\r\nfmt.Println(time.Now())\r\nres, _ := db.Exec(\"INSERT INTO doc (`time`)VALUES(?)\", time.Now())\r\nid, _ := res.LastInsertId()\r\nfmt.Println(id)\r\nvar t string\r\ndb.QueryRow(\"SELECT `time` FROM doc WHERE id = ?\", id).Scan(&t)\r\nfmt.Println(t)\r\n```\r\n\r\nBefore version 1.0.3 (included) output is\r\n\r\n```\r\n2014-01-03 14:55:50.430158786 +0800 CST\r\n1\r\n2014-01-03 14:55:50\r\n```\r\n\r\nLatest version output is. The timezone always is UTC. Can not detect the current timezone.\r\n\r\n```\r\n2014-01-03 14:59:31.729418163 +0800 CST\r\n2\r\n2014-01-03 06:59:31\r\n```\r\n\r\nWhat's wrong with this. May I miss something?\r\n"},"comment":{"url":"https://api.github.com/repos/go-sql-driver/mysql/issues/comments/233255452","html_url":"https://github.com/go-sql-driver/mysql/issues/203#issuecomment-233255452","issue_url":"https://api.github.com/repos/go-sql-driver/mysql/issues/203","id":233255452,"user":{"login":"arnehormann","id":1011413,"avatar_url":"https://avatars.githubusercontent.com/u/1011413?v=3","gravatar_id":"","url":"https://api.github.com/users/arnehormann","html_url":"https://github.com/arnehormann","followers_url":"https://api.github.com/users/arnehormann/followers","following_url":"https://api.github.com/users/arnehormann/following{/other_user}","gists_url":"https://api.github.com/users/arnehormann/gists{/gist_id}","starred_url":"https://api.github.com/users/arnehormann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arnehormann/subscriptions","organizations_url":"https://api.github.com/users/arnehormann/orgs","repos_url":"https://api.github.com/users/arnehormann/repos","events_url":"https://api.github.com/users/arnehormann/events{/privacy}","received_events_url":"https://api.github.com/users/arnehormann/received_events","type":"User","site_admin":false},"created_at":"2016-07-18T07:39:22Z","updated_at":"2016-07-18T07:39:22Z","body":"As @methane says. I'll just defer to @xaprb here, follow his advice if at all possible: http://www.xaprb.com/blog/2014/01/30/timestamps-in-mysql/"}}
{"actor":{"display_login":"arnehormann"}}