转载地址:http://blog.csdn.net/dante_k7/article/details/5718712
在Postgresql中可以直接对timestamp进行加减运算:
timestamp + interval
SELECT now()::timestamp + '1 year'; 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'; SELECT now()::timestamp + (col || ' day')::interval FROM table