MySQL 日期加减
select adddate(now(),1); -- 加1天
select adddate(now(), interval 1 day); -- 加1天
select adddate(now(), interval 1 hour); --加1小时
select adddate(now(), interval 1 minute); -- 加1分钟
select adddate(now(), interval 1 second); -- 加1秒
select adddate(now(), interval 1 microsecond); -- 加1毫秒
select adddate(now(), interval 1 week); -- 加1周
select adddate(now(), interval 1 month); -- 加1月
select adddate(now(), interval 1 quarter); -- 加1季
select adddate(now(), interval 1 year); -- 加1年
postgreSQL日期加减
SELECT now()::timestamp + '1 year'; --当前时间加1年
SELECT now()::timestamp + '1 month'; --当前时间加一个月
SELECT now()::timestamp + '1 day'; --当前时间加一天
SELECT now()::timestamp + '1 hour'; --当前时间加一个小时
SELECT now()::timestamp + '1 min'; --当前时间加一分钟
SELECT now()::timestamp + '1 sec'; --加一秒钟
select now()::timestamp + '1 year 1 month 1 day 1 hour 1 min 1 sec'; --加1年1月1天1时1分1秒
SELECT now()::timestamp + (col || ' day')::interval FROM table --把col字段转换成天 然后相加