DATE_ADD(date, INTERVAL value unit)
DATE_SUB(date, INTERVAL value unit)
예제)
- where {테이블 날짜 컬럼} < DATE_SUB(NOW(), INTERVAL 7 DAY)
- DATE_ADD('2018-03-20', INTERVAL 7 DAY)
unit
- MICROSECOND
- SECOND
- MINUTE
- HOUR
- DAY
- WEEK
- MONTH
- QUARTER
- YEAR
- SECOND_MICROSECOND
- MINUTE_MICROSECOND
- MINUTE_SECOND
- HOUR_MICROSECOND
- HOUR_SECOND
- HOUR_MINUTE
- DAY_MICROSECOND
- DAY_SECOND
- DAY_MINUTE
- DAY_HOUR
- YEAR_MONTH
댓글 없음:
댓글 쓰기