TIMESTAMP vs. DATETIME MySQL

This question already has an answer here:

  • Should I use the datetime or timestamp data type in MySQL? 33 answers

  • Internally all TIMESTAMP data is stored as 4 byte integer denoting number of seconds since Unix epoch. What you see presented in your software is dependent on how your software presents this data. For example, if you change your timezone to different one, it will have an effect on data read from TIMESTAMP column (beacuse Unix epoch is in UTC)

    There will be no mixing of data. MySQL will take care of converting your YYYY-MM-DD HH:MM:SS into timestamps. Be wary of timezones though!

    When querying TIMESTAMP columns, MySQL will by default format them in human readable form, so don't expect to get integers from these. You will get a string formatted in YYYY-MM-DD HH:MM:SS just like from DATETIME fields.

    链接地址: http://www.djcxy.com/p/25072.html

    上一篇: MySQL忽略我的索引

    下一篇: TIMESTAMP与DATETIME MySQL