일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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
- HTTP
- 전자정부표준프레임워크
- Date and Time Function
- 오라클
- Date and Time Functions
- SVN
- Data and Time Functions
- 전자정부 표준프레임워크
- 티베로
- String Functions and Date Operators
- Oracle
- 윈도우
- String Functions and Operators
- 방화벽
- String Function and Operators
- MySQL
- Tibero
- 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 |