Skip to content

Instantly share code, notes, and snippets.

@webgyo
Forked from tanakahisateru/gist:15488cfd13a4fc9bf9ee
Last active August 29, 2015 14:11
Show Gist options
  • Select an option

  • Save webgyo/edd8f6ffbfd366276a20 to your computer and use it in GitHub Desktop.

Select an option

Save webgyo/edd8f6ffbfd366276a20 to your computer and use it in GitHub Desktop.
CREATE TABLE test (
day1 DATETIME,
day2 TIMESTAMP
);
SET SESSION time_zone = 'UTC';
INSERT INTO test VALUES ('2014-12-25 00:00:00', '2014-12-25 00:00:00');
SET SESSION time_zone = 'Asia/Tokyo';
INSERT INTO test VALUES ('2014-12-25 00:00:00', '2014-12-25 00:00:00');
SET SESSION time_zone = 'UTC';
SELECT * FROM test;
-- day1 day2
-- 2014-12-25 00:00:00 2014-12-25 00:00:00
-- 2014-12-25 00:00:00 2014-12-24 15:00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment