Doug’s Blog

Handily dispensing information to .00000001% of the world’s population

Posts Tagged ‘mysql auto timestamp’

Automatically insert Current Date and Time in MySQL table

Saturday, March 16th, 2013

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