How to store current time in database
I want have a field in mysql where the Current time must be auto-ge开发者_运维百科nerated, say when the record is inserted into it.
Please help me ........
From MySQL:
In a CREATE TABLE statement, the first TIMESTAMP column can be declared in any of the following ways:
With both DEFAULT CURRENT_TIMESTAMP and ON UPDATECURRENT_TIMESTAMP clauses, the column has the current timestamp for its default value, and is automatically updated.
You could have a TIMESTAMP field, with the default set to CURRENT TIMESTAMP.
You can also use the ON UPDATE CURRENT TIMESTAMP property and it will change whenever any field on the row is updated.
http://dev.mysql.com/doc/refman/5.0/en/timestamp.html
加载中,请稍侯......
精彩评论