The main remaining data types supported by MySQL relate to the date and time and can be seen in following Table.

Data type

Time/date Format


‘0000-00-00 00:00:00’

DATE ‘0000-00-00’
TIMESTAMP ‘0000-00-00 00:00:00’
TIME ’00:00:00′
YEAR 0000 (Only years 0000 and 1901–2155)

The DATETIME and TIMESTAMP data types display the same way. The main difference is that TIMESTAMP has a very narrow range (from the years 1970 through 2037), whereas DATETIME will hold just about any date you’re likely to specify, unless you’re interested in ancient history or science fiction.
TIMESTAMP is useful, however, because you can let MySQL set the value for you. If you don’t specify the value when adding a row, the current time is automatically inserted. You can also have MySQL update a TIMESTAMP column each time you change a row.


You may also like...