timestamp or int in mysql |
Might depend on how you want to use it. Using int, it may be a bit easier and faster to compare values in certain circumstances. For example, you want to see if a certain interval has passed since the last login.
PHP Code: if($last_login + $check_interval < time()){ ... On the other hand, the mysql DATETIME type is easily used to make a PHP DateTime object. From there it's easy to get a display string formatted just about any way you want. The DATETIME type is handy when you want to automatically capture the last time a record is updated. For instance, consider a user profile where a column is defined like this Code: `last_updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP will capture the update time without any added code on your part. |
Messages In This Thread |
timestamp or int in mysql - by glorsh66 - 10-14-2017, 05:27 AM
RE: timestamp or int in mysql - by dave friend - 10-14-2017, 06:23 AM
RE: timestamp or int in mysql - by PaulD - 10-14-2017, 08:07 AM
|