赞
踩
1.获取当前日期时间:SELECT CURRENT_TIMESTAMP
2019-09-02 11:27:37.282+08
2.获取当前时间:SELECT CURRENT_TIME
11:28:39.636+08
3.获取当前日期:SELECT CURRENT_DATE
2019-09-02
4.获取5天前日期时间:SELECT CURRENT_TIMESTAMP-interval'5DAY'
2019-08-28 11:33:20.536+08
4.获取5天后日期时间:SELECT CURRENT_TIMESTAMP+interval'5DAY'
2019-09-07 11:34:17.142+08
5.获取一个月前日期时间:SELECT CURRENT_TIMESTAMP-interval'1MONTH'
2019-08-02 11:35:21.813+08
6.获取一年前日期时间:SELECT CURRENT_TIMESTAMP-interval'1YEAR'
2018-09-02 11:36:39.686+08
SELECT * FROM table WHERE createtime BETWEEN CURRENT_TIMESTAMP-interval'1YEAR' and CURRENT_TIMESTAMP
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。