MySQL TIMESTAMP (TIMESTAMP) details, mysqltimestamp
When creating a table, if a field type in the table is TIMESTAMP, the default statement for generating this field is:
CREATE TABLE `test` ( `id` int(11) DEFAULT NULL, `ctime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB DEFAULT CHARSET=gbk
If two fields are of the TIMESTAMP type, the generated statement is:
CREATE TABLE `test` ( `id` INT(11) DEFAULT NULL, `ctime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `utime` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00') ENGINE=INNODB DEFAULT CHARSET=gbk
The Default value of TIMESTAMP is Default CURRENT_TIMESTAMP,
The TIMESTAMP is set to automatically update on update CURRENT_TIMESTAMP as the table changes.
A table can have at most one field set CURRENT_TIMESTAMP (current time)
1. timestamp default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP
This data column is refreshed when a new record is created and an existing record is modified.
2. timestamp default CURRENT_TIMESTAMP
This field is set to the current time when a new record is created, but it will not be refreshed when it is modified later.
3. timestamp on update CURRENT_TIMESTAMP
Set this field to 0 when creating a new record, and refresh it later.
Reprinted please indicate the source: http://blog.csdn.net/itmyhome1990/article/details/39342245
How to convert mysql timestamp to timestamp
Select to_timestamp ('2017-11-02 04:05:10 ', 'yyyy-MM-DD HH: MI: ss ')
From dual;
Is the timestamp type of mysql from January 1, 1970 to the present?
Yes, the current number of milliseconds