Should I use field 'datetime' or 'timestamp'?
I'm working with PHP on the server side.
solution:
Timestamps in MySQL generally used to track change to
records, and are often updated each time the record is changed. If you want to
store a specific value you should use a datetime field.
If you meant that you want to decide linking using a UNIX
timestamp or a native MySQL datetime field, go with the native format. You can
do calculations within MySQL that way
("SELECT DATE_ADD(my_datetime, INTERVAL 1 DAY)")
and it is easy
to change the arrange of the value to a UNIX timestamp ("SELECT UNIX_TIMESTAMP(my_datetime)") when you query the record if you want to
operate on it with PHP.
COMMENTS