TIMESTAMPand theDATETIMEthe Difference1. Different storage space
A) TIMESTAMP occupies 4 bytes
b) DATETIME occupies 8 bytes
2. Affected by Time zone
c) TIMESTAMP actually records the number of 1970-01-01 00:00:01 to the present, affected by the time zone
D) DATETIME is not affected by time zone
3. Different time range
e) TIMESTAMP time range is:' 1970-01-01 00:00:01 ' UTC ~ ' 2038-01-19 03:14:07 ' UTC
f) DateTime Time range is:' 1000-01-01 00:00:00 ' ~ ' 9999-12-31 23:59:59 '
4. Automatic Updates
g) TIMESTAMP type by default,when theinsert,update data,TIMESTAMP The column is automatically populated/updated with the current time (current_timestamp) .
5. Mysqlin whichTIMESTAMPand theLongthe conversion function between:
h) TIMESTAMP to long:unix_timestamp
i) long turn TIMESTAMP:from_unixtime
The difference between timestamp and datetime