Categories
Coding

Automatically insert Current Date and Time in MySQL table

I was trying to recall how to create a field in a MYSQL table that will auto timestamp on inserts or updates, and surprisingly google did not give any direct and easy results! Seriously, the results were either off topic or packed with ads and off topic.

Here it is, simple and to the point:

`timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP