Jump to content

Quick DATE question guys/girls


mak-uk

Recommended Posts

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 :)

Link to comment
https://forums.phpfreaks.com/topic/741-quick-date-question-guysgirls/
Share on other sites

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.