天天看点

在数据库创建表的时候,时间设置为什么类型,会随着每次提交的时间发生变化

create table ab

{

      id int(6) not null auto_increment,

      name varchar(30),

      reg_date dateTime

)

这样创建的,每次我们提交表单的时候时间还要我们单独写,但是如果我们将最后 的时间的类型改变,这样我们在数据库中每一次更新数据的时候,时间就会自动的更新,这个时候我们也不需要写时间了

create table ab

{

      id int(6) not null auto_increment,

      name varchar(30),

      reg_date timestamp

)

这样每次数据库中更新数据的时候,时间就会自动的更新。