Reputation: 239
I want to add the date/time of the moment when a row was inserted for the first time.
There are two different date/time formats, depending on if it's going to be used in SQL or PHP. It's going to be stored in SQL so that I can check this time from a PHP application.
What should the data type be, DATETIME or TIMESTAMP?
How do I insert the current date/time by default?
Upvotes: 0
Views: 63
Reputation: 1539
You can implement an trigger
on insert, update that table, and call update your datetime column whenever with now()
Upvotes: 1