如果是mysql数据库,那么直接将now()值插入数据库即可,如果testDate表的datevalue字段的数据类型是date,则如下:
insert into testDate(dateValue) values(now());
但是oracle中直接这样,是会报错的,那么我们用如下方法,我这里总结下:
/*如果datecal是date型字段*/
insert into tabname(datecol) value(sysdate) ; -- 用date值
insert into tabname(datecol) value(sysdate+1) ; -- 用date值
insert into tabname(datecol) value(to_date('2014-02-14','yyyy-mm-dd')) ; -- 用to_date
insert into tabname(datecol) value(to_date('2014-02-14 20:47:00','yyyy-mm-dd hh24:mi:ss')) ; -- 用to_date
insert into tabname(datecol) value(to_date('20140214','yyyymmdd')) ; -- 用to_date
insert into tabname(datecol) value(to_date('20140214204700','yyyymmddhh24miss')) ; -- 用to_date