일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Sring Functions and Operators
- String Function and Operators
- 전자정부 표준프레임워크
- Tibero
- 방화벽
- Data and Time Functions
- HTTP
- String Functions and Operators
- 오라클
- SVN
- 전자정부표준프레임워크
- Date and Time Functions
- 윈도우
- String Functions and Date Operators
- MySQL
- Date and Time Function
- 티베로
- Oracle
- Today
- Total
웹이야기
MySQL DATEDIFF() 본문
MySQL 날짜함수, 시간함수
DATEDIFF()
- 날짜의 차이를 구하는 함수. expr1 - expr2.
DATEDIFF(expr1, expr2)
DATEDIFF() returns expr1 - expr2 expressed as a value in days from one date to other. expr1 and expr2 are date or date-and-time expressions. Only the date parts of the values are used in the calculation
mysql> SELECT DATEDIFF('2007-12-31 23:59:59','2007-12-30');
+----------------------------------------------+
| DATEDIFF('2007-12-31 23:59:59','2007-12-30') |
+----------------------------------------------+
| 1 |
+----------------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT DATEDIFF(NOW(), CURDATE());
+-----------------------------+
| DATEDIFF(NOW(), CURDATE()) |
+-----------------------------+
| 0 |
+-----------------------------+
1 row in set (0.00 sec)
'D > MySQL' 카테고리의 다른 글
MySQL DATE_FORMAT() (0) | 2020.04.01 |
---|---|
MySQL DATE_ADD(), DATE_SUB() (0) | 2020.04.01 |
MySQL DATE() (0) | 2020.04.01 |
MySQL CURRENT_TIMESTAMP, CURRENT_TIMESTAMP() (0) | 2020.04.01 |
MySQL CURRENT_TIME, CURRENT_TIME() (0) | 2020.04.01 |