Forums

This topic is locked

Adding dates to MySQL records

Posted 14 Dec 2006 19:38:05
1
has voted
14 Dec 2006 19:38:05 David Karpman posted:
Greetings, and please bear with me, I am an MySQL newbie.

I am trying to do something simple, that is having the date a record is added to be inserted into the record. I am setting up a very simple form, consisting of three text records - Two text fields, and a message text area (no date entry by user). After the user submits the record, I want it date stamped so that the record will display the date of record submission.

I have spun my wheels for a few hours with this. I have Dreamweaver 8, and cannot seem to find a dynamic date entry. I have learned a lot in the process, but have yet to find the solution.

Any help greatly appreciated.

David Karpman

Replies

Replied 16 Dec 2006 21:37:41
16 Dec 2006 21:37:41 Alan C replied:
You can use the mysql NOW() function to get the current date and time.

There is also a TIMESTAMP type in mysql dev.mysql.com/doc/refman/5.0/en/datetime.htm the properties are different in version 5 so you need to check which version you are running. If you use TIMESTAMP you need to be aware that it can be automatically updated each time the table row is updated, I think it's the first TIMESTAMP column that gets the auto update.

Reply to this topic