mak-uk Posted July 19, 2003 Share Posted July 19, 2003 Hi I want to store the mJoinDate and mLastLogin of a particular user. Initially, I had for the first field: [php:1:b3f9e28bcf]`mJoinDate` timestamp(14) NOT NULL,[/php:1:b3f9e28bcf] Then, when I realised I need mLastLogin, I saw a tutorial and in that they were both as: [php:1:b3f9e28bcf]signup_date datetime NOT NULL default \'0000-00-00 00:00:00\', last_login datetime NOT NULL default \'0000-00-00 00:00:00\', [/php:1:b3f9e28bcf] So what I am wondering is, which \'type\' should I use - timestamp or datetime? Thanks. Mak Quote Link to comment Share on other sites More sharing options...
mitsimic Posted July 25, 2003 Share Posted July 25, 2003 I would personally use the second option: signup_date datetime NOT NULL default \'0000-00-00 00:00:00\', last_login datetime NOT NULL default \'0000-00-00 00:00:00\', Cheers :roll: Quote Link to comment Share on other sites More sharing options...
mak-uk Posted July 25, 2003 Author Share Posted July 25, 2003 Hi Any particular reason for choosing them rather than TIMESTAMP? Thanks. Mak Quote Link to comment Share on other sites More sharing options...
Barand Posted July 27, 2003 Share Posted July 27, 2003 Use timestamp when you want to record when the record was added or last updated. This will happen automatically if you do not write a value to it (or write NULL to it). (But only for one timestamp field per record). If the time is not relevant, just use DATE type (eg birthdays, date joined etc) hth Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.