TIMESTAMP column will be set to the current date and time whenever that row is updated or inserted in the table.
TIMESTAMP can only handle dates in the range 1970 through 2037.
TIMESTAMP data can be held with the maximum resolution of one second.
TIMESTAMP can have a number of external formats.
These can be made up of any even number of digits from 2 to 14.
TIMESTAMP fields are set to the current time if you do not write anything to them.
MySQL sets a TIMESTAMP column to the current time if NULL (or NOW()) is written to it.
Illegal values will be discarded and replaced with the "zero" value for this field type.
MySQL is flexible in the formats accepting for the TIMESTAMP.
For example, it will accept 2000-05-12, 2000+05+12, and 20000512.
If the field is left out when doing an insert or update, it will only update the first TIMESTAMP field in the table.
Subsequent TIMESTAMP fields will contain the zero value if not set explicitly.
If you have a DATE value and want to write it to a DATETIME or TIMESTAMP column, MySQL will insert 00:00:00 for the time portion.
The format varies according to the length.
For example to store the same information as DATETIME, you would specify a length of 14 whereas to store the DATE you would specify a length of 8.
Timestamp Definition | Format |
TIMESTAMP(2) | YY |
TIMESTAMP(4) | YYYY |
TIMESTAMP(6) | YYMMDD |
TIMESTAMP(8) | YYYYMMDD |
TIMESTAMP(10) | YYMMDDHHMM |
TIMESTAMP(12) | YYMMDDHHMMSS |
TIMESTAMP(14) | YYYYMMDDHHMMSS |