Mysql store time field




     Brothers Education (www.lampbrother.net) database training tutorial Mysql uses int, timestamp or datetime to store time fields.

Usually, datetime type is used to store time. Now many systems also use int to store time. What is the difference between them? The summary is as follows:

  int

  (1) .4 bytes of storage, the length of INT is 4 bytes, the storage space is less than that of datatime, the storage space of int index is also relatively small, and the sorting and query efficiency is relatively high

  (2) The readability is extremely poor, Not being able   to see the   data   intuitively may make you very

  annoyed time zone.   (4) TIMESTAMP value cannot be earlier than 1970 or later than 2037   datetime   (1) 8 bytes storage   (2) independent of time zone   (3) retrieve and display DATETIME value in 'YYYY-MM-DD HH:MM:SS' format . The supported range is from '1000-01-01 00:00:00' to '9999-12-31 23:59:59'   depending on personal habits and project needs.



















Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326406925&siteId=291194637