일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- MySQL
- String Function and Operators
- SVN
- HTTP
- Sring Functions and Operators
- 윈도우
- Data and Time Functions
- String Functions and Operators
- Date and Time Function
- 전자정부 표준프레임워크
- Date and Time Functions
- String Functions and Date Operators
- 방화벽
- 오라클
- Tibero
- 전자정부표준프레임워크
- 티베로
- Oracle
- Today
- Total
웹이야기
MySQL TIMEDIFF() 본문
MySQL 날짜함수, 시간함수
TIMEDIFF()
- 시간의 차이를 구해주는 함수.
TIMEDIFF(expr1, expr2)
의 형태
TIMEDIFF() returns expr1 - expr2 expressed a s a TIME value. expr1 and expr2 are time or date-and-time expressions, but both must be of the same type.
The resuilt returned by TIMEDIFF() is limited to the range allowed for TIME vlaues. Alternatively , you can use either of the functions TIMESTAMPDIFF() and UNIX_TIMESTAMP(), both of which return integers.
mysql> SELECT TIMEDIFF('2020-04-03 22:21:20', '2020-03-01 11;11:11');
+--------------------------------------------------------+
| TIMEDIFF('2020-04-03 22:21:20', '2020-03-01 11;11:11') |
+--------------------------------------------------------+
| 803:10:09 |
+--------------------------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT TIMEDIFF('2020-04-03 22:21:20', '2020-03-01 11;11:11.777777');
+---------------------------------------------------------------+
| TIMEDIFF('2020-04-03 22:21:20', '2020-03-01 11;11:11.777777') |
+---------------------------------------------------------------+
| 803:10:08.222223 |
+---------------------------------------------------------------+
1 row in set (0.00 sec)
'D > MySQL' 카테고리의 다른 글
MySQL TIMESTAMPADD() (0) | 2020.04.04 |
---|---|
MySQL TIMESTAMP() (0) | 2020.04.04 |
MySQL TIME() (0) | 2020.04.03 |
MySQL SYSDATE() (0) | 2020.04.03 |
MySQL SUBTIME() (0) | 2020.04.03 |