查询时间
select now();
select current_timestamp;
select current_time;
select current_date;
current_timestamp函数以`'YYYY-MM-DD HH:MM:SS’返回当前的日期时间,可以直接存到DATETIME字段中。
current_date()以’YYYY-MM-DD’的格式返回今天的日期,可以直接存到DATE字段中。
current_time()以’HH:MM:SS’的格式返回当前的时间,可以直接存到TIME字段中。
插入当前时间
SELECT * from `user`;
UPDATE user
set create_date=now()
where num='170440120';
SELECT * from `user`;
插入指定时间
SELECT * from `user`;
UPDATE user
set create_date="1997-07-18 03:01:30"
where num='170440120';
SELECT * from `user`;
时间的比较
select *
from user
where create_date < "2020-10-05 19:43:05";