Created
March 18, 2016 05:19
-
-
Save chen206/72fc51ac3272e70f85de to your computer and use it in GitHub Desktop.
MySQL日期时间时区
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE `tbl_test` ( | |
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, | |
`ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, | |
PRIMARY KEY (`id`) | |
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8; | |
SELECT @@session.time_zone; | |
SELECT @@global.time_zone; | |
SET @@session.time_zone='+08:00'; | |
INSERT INTO tbl_test (ts) VALUES ('2016-01-26 19:35:24'); | |
SET @@session.time_zone='+02:00'; | |
SELECT * FROM tbl_test; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment