How to convert full date/time to timestamp?

What, if any, is the performance difference between datetime and timestamp?

  • Answer:

    Adding to Josh's answer, they have different storage sizes and representations. You can infer that TIMESTAMP is a UNIX time value (seconds since UNIX epoch). But being concerned with performance differences between these types is usually pointless micro-optimisation in the context of a disk based database; any I/O swamps any difference, even if it could be measured otherwise. You should choose the type that best models your data.

Toby Thain at Quora Visit the source

Was this solution helpful to you?

Other answers

DateTime: has a range of '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. TimeStamp: has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC. Therefore, TimeStamp is more efficient to store and transmit because it supports a more limited date range. I do not know of any other differences. Further reading can be found here: http://dev.mysql.com/doc/refman/5.0/en/datetime.html

Josh Thornton

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.