sql-info.de
December 1, 2004

MySQL | TIMESTAMP DEFAULT NOW()

A common problem in MySQL is the comparatively simple act of defining a TIMESTAMP column which has as its default value the timestamp at the time the record is created. In most databases this is simply a case of appending DEFAULT NOW() to the timestamp column.

Beginning with version 4.1.2 MySQL now supports this, albeit as an overlay to the slightly eccentric TIMESTAMP functionality, making life just that little bit easier.

Note that CURRENT_TIMESTAMP or CURRENT_TIMESTAMP() can also be used, having the same meaning as NOW().

More information about TIMESTAMP support in MySQL 4.1 can be found here:

Posted at 8:40 PM