You are here

mysql date

Why Integer instead of datetime in mysql

A MySQL datetime field is quite difficult to manipulate. If you want to do anything with it, you need to either run SQL with datetime functions, which can become quite complex, or retrieve the records and then use PHP code to convert the data. On the other hand, a unix timestamp is just a number, so selections are quick, it easy to do comparisons, etc. Furthermore, Datetime is stored as a string, which takes up more space than an int, and querying is slower, as most RDBMS engines index int's a lot more efficient. And a final concern is portability.

Subscribe to RSS - mysql date

User login