简单的日期判断

判断一个日期regist_date,超过30天(一个月)

oracle 中
select * from yourtable where regist_date + 30 > sysdate;


可是忘记了这是在postgres ,
查看了下属性,timestamp without time zone
没有时区限制的日期+时间

重新考虑 ,妈的,连sysdate都没有
select * from yourtable where regist_date + '30' > current_timestamp;



哦,以上的错了哦,大意了
http://www.pgsqldb.org/mwiki/index.php/%E6%97%B6%E9%97%B4/%E6%97%A5%E6%9C%9F%E5%87%BD%E6%95%B0%E5%92%8C%E6%93%8D%E4%BD%9C%E7%AC%A6


select * from yourtable where regist_date + interval '30 day' > current_timestamp;


或者用 30days
不知道day 跟days有什么区别阿


又仔细看了下,还是用
select * from yourtable where age(regist_date) > '30 days'; 

你可能感兴趣的:(oracle,sql,PHP)