Mega Code Archive

 
Categories / MySQL / Date Time
 

Literal for timestamp type column

mysql> mysql> CREATE TABLE TZ (COL1 TIMESTAMP); Query OK, 0 rows affected (0.00 sec) mysql> mysql> INSERT INTO TZ VALUES ('2005-01-01 12:00:00'); Query OK, 1 row affected (0.00 sec) mysql> mysql> SELECT * FROM TZ; +---------------------+ | COL1                | +---------------------+ | 2005-01-01 12:00:00 | +---------------------+ 1 row in set (0.00 sec) mysql> mysql> SET @@TIME_ZONE = '+10:00'; Query OK, 0 rows affected (0.00 sec) mysql> mysql> SELECT * FROM TZ; +---------------------+ | COL1                | +---------------------+ | 2005-01-02 06:00:00 | +---------------------+ 1 row in set (0.00 sec) mysql> mysql> drop table TZ; Query OK, 0 rows affected (0.00 sec) mysql>