일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
- Date and Time Function
- String Function and Operators
- HTTP
- SVN
- Date and Time Functions
- 티베로
- MySQL
- 전자정부표준프레임워크
- 오라클
- Tibero
- Data and Time Functions
- String Functions and Date Operators
- 전자정부 표준프레임워크
- String Functions and Operators
- Sring Functions and Operators
- Oracle
- 방화벽
- 윈도우
- Today
- Total
웹이야기
MySQL ADDDATE() 본문
MySQL 날짜함수, 시간함수
ADDDATE()
ADDDATE(date, INTERVAL expr unit)
또는
ADDDATE(expr, days) 형태
When invoked with the INTERVAL form of the second argument, ADDDATE() is a synonym for DATE_ADD(). The related function SUBDATE() is a synonym for DATE_SUB(). For information on the INTERVAL unit argument.
mysql> SELECT DATE_ADD('2001-01-02', INTERVAL 31 DAY); +-----------------------------------------+
| DATE_ADD('2001-01-02', INTERVAL 31 DAY) |
+-----------------------------------------+
| 2001-02-02 |
+-----------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT ADDDATE('2001-01-02', INTERVAL 31 DAY);
+----------------------------------------+
| ADDDATE('2001-01-02', INTERVAL 31 DAY) |
+----------------------------------------+
| 2001-02-02 |
+----------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT ADDDATE('2001-01-02', 31) ;
+---------------------------+
| ADDDATE('2001-01-02', 31) |
+---------------------------+
| 2001-02-02 |
+---------------------------+
1 row in set (0.00 sec)
INTERVAL unit 으로 쓸 수 있는 것들
unit value | Expected expr Format |
MICROSECOND | MICROSECONDS |
SECOND | SECONDS |
MINUTE | MINUTES |
HOUR | HOURS |
DAY | DAYS |
WEEK | WEEKS |
MONTH | MONTHS |
QUARTER | QUARTERS |
YEAR | YEARS |
SECOND_MICROSECOND | 'SECONDS.MICROSECONDS' |
MINUTE_MICROSECOND | 'MINUTES:SECONDS.MICROSECONDS' |
MINUTE_SECOND | 'MINUTES:SECONDS' |
HOUR_MICROSECOND | 'HOURS:MINUTES:SECONDS.MICROSECONDS' |
HOUR_SECOND | 'HOURS:MINUTES:SECONDS' |
HOUR_MINUTE | 'HOURS:MINUTES' |
DAY_MICROSECOND | 'DAYS HOURS:MINUTES:SECONDS.MICROSECONDS' |
DAY_SECOND | 'DAYS HOURS:MINUTES:SECONDS' |
DAY_MINUTE | 'DAYS HOURS:MINUTES' |
DAY_HOUR | 'DAYS HOURS' |
YEAR_MONTH | 'YEARS-MONTHS' |
'D > MySQL' 카테고리의 다른 글
MySQL CONVERT_TZ() (0) | 2020.04.01 |
---|---|
MySQL ADDTIME() (0) | 2020.04.01 |
MySQL Date and Time Functions (0) | 2020.03.31 |
MySQL TRUNCATE() (0) | 2020.03.29 |
MySQL SIN() (0) | 2020.03.29 |