火冰狐 发表于 2016-11-21 04:12:05

在PostgreSQL中可以直接对timestamp进行加减运算:

  01.SELECT now()::timestamp + '1 year';  
02.SELECT now()::timestamp + '1 month';  
03.SELECT now()::timestamp + '1 day';  
04.SELECT now()::timestamp + '1 hour';  
05.SELECT now()::timestamp + '1 min';  
06.SELECT now()::timestamp + '1 sec';  
07.select now()::timestamp + '1 year 1 month 1 day 1 hour 1 min 1 sec';  
08.SELECT now()::timestamp + (col || ' day')::interval FROM table
  本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/dante_k7/archive/2010/07/07/5718712.aspx
页: [1]
查看完整版本: 在PostgreSQL中可以直接对timestamp进行加减运算: