Created
December 11, 2012 16:25
-
-
Save abby-sergz/4260007 to your computer and use it in GitHub Desktop.
This file contains 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 xxxDate(ts TIMESTAMP NOT NULL, dt DATETIME NOT NULL); |
This file contains 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
insert into xxxDate values('2012-06-10 15:08:05', '2012-06-10 15:08:05'); | |
insert into xxxDate values('2012-12-10 15:08:05', '2012-12-10 15:08:05'); |
This file contains 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
set time_zone='Europe/London'; | |
select * from xxxDate; | |
+---------------------+---------------------+ | |
| ts | dt | | |
+---------------------+---------------------+ | |
| 2012-06-10 12:08:05 | 2012-06-10 15:08:05 | | |
| 2012-12-10 11:08:05 | 2012-12-10 15:08:05 | | |
+---------------------+---------------------+ |
This file contains 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
select UNIX_TIMESTAMP(ts), UNIX_TIMESTAMP(dt) from xxxDate; | |
+--------------------+--------------------+ | |
| UNIX_TIMESTAMP(ts) | UNIX_TIMESTAMP(dt) | | |
+--------------------+--------------------+ | |
| 1339326485 | 1339337285 | // 14h (dt) | |
| 1355137685 | 1355152085 | // 15h (dt) | |
+--------------------+--------------------+ |
This file contains 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
select * from xxxDate; | |
+---------------------+---------------------+ | |
| ts | dt | | |
+---------------------+---------------------+ | |
| 2012-06-10 15:08:05 | 2012-06-10 15:08:05 | | |
| 2012-12-10 15:08:05 | 2012-12-10 15:08:05 | | |
+---------------------+---------------------+ | |
select UNIX_TIMESTAMP(ts), UNIX_TIMESTAMP(dt) from xxxDate; | |
+--------------------+--------------------+ | |
| UNIX_TIMESTAMP(ts) | UNIX_TIMESTAMP(dt) | | |
+--------------------+--------------------+ | |
| 1339326485 | 1339326485 | | |
| 1355137685 | 1355137685 | | |
+--------------------+--------------------+ |
This file contains 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
set time_zone='Europe/Moscow'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment