-- 减法 select date_format(now() - '1 HOUR'::interval , '%Y-%m-%d %H' ); select date_format(now() - '1 DAY'::interval , '%Y-%m-%d %H' ); select date_format(now() - '1 WEEK'::interval , '%Y-%m-%d %H' ); select date_format(now() - '1 MONTH'::interval , '%Y-%m-%d %h' ); select date_format(now() - '1 YEAR'::interval , '%Y-%m-%d %H' ); -- 加法 select date_format(now() - '-1 HOUR'::interval , '%Y-%m-%d %H' ); select date_format(now() - '-1 DAY'::interval , '%Y-%m-%d %H' ); select date_format(now() - '-1 WEEK'::interval , '%Y-%m-%d %H' ); select date_format(now() - '-1 MONTH'::interval , '%Y-%m-%d %h' ); select date_format(now() - '-1 YEAR'::interval , '%Y-%m-%d %H' );
标签:-%,金仓,interval,format,数据库,人大,date,now,select From: https://www.cnblogs.com/xuchao0506/p/17890767.html