Skip to content

Record when a recored is created and updated using Timestamp

In MySQL you can use a TIMESTAMP field and use CURRENT_TIMESTAMP as the default value for Update.

CREATE TABLE tbl1 (
  ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  dt DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
   ...
);


Feedback and Knowledge Base