2010-09-01 110 views

回答

33

這是正確的。在SQL代碼,這將是:

CREATE TABLE `table` (
    ... 
    `date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, 
    ... 
) 
+0

非常感謝你 – BigMike 2010-09-01 13:29:47

5

是,這種方法是正確的:

create table t(Id int, ts timestamp default current_timestamp) 

insert into t(Id) values (1) 

select * from t 

1;2010-09-01 09:20:09:000 
+0

謝謝。這是一個很大的幫助 – BigMike 2010-09-01 14:06:00

+1

由於這是時間戳,因此不應該將其顯示爲秒數而不是日期時間。 – Foreever 2015-08-20 16:54:24