일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- SVN
- Data and Time Functions
- String Functions and Date Operators
- 티베로
- HTTP
- Oracle
- String Functions and Operators
- 방화벽
- Date and Time Function
- MySQL
- String Function and Operators
- 오라클
- Tibero
- 전자정부표준프레임워크
- 윈도우
- Sring Functions and Operators
- 전자정부 표준프레임워크
- Date and Time Functions
- Today
- Total
웹이야기
MySQL SUBTIME() 본문
MySQL 날짜함수, 시간함수
SUBTIME()
- 시간을 빼는 함수
SUBTIME(expr1, expr2)
의 형태
SUBTIME() returns expr1 - expr2 expressed as a value in the same format as expr1. expr1 is a time or datetime expression, and expr2 is a time expression.
mysql> SELECT SUBTIME('2007-12-31 23:59:59', '1 1:1:1.000002');
+--------------------------------------------------+
| SUBTIME('2007-12-31 23:59:59', '1 1:1:1.000002') |
+--------------------------------------------------+
| 2007-12-30 22:58:57.999998 |
+--------------------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT SUBTIME('01:00:00.999999' ,'02:00:00.999999');
+-----------------------------------------------+
| SUBTIME('01:00:00.999999' ,'02:00:00.999999') |
+-----------------------------------------------+
| -01:00:00 |
+-----------------------------------------------+
1 row in set (0.01 sec)
mysql> SELECT SUBTIME('03:00:00' ,'02:00:00');
+---------------------------------+
| SUBTIME('03:00:00' ,'02:00:00') |
+---------------------------------+
| 01:00:00 |
+---------------------------------+
1 row in set (0.00 sec)
mysql> SELECT SUBTIME('03:00:00' ,'02:00:00')+0;
+-----------------------------------+
| SUBTIME('03:00:00' ,'02:00:00')+0 |
+-----------------------------------+
| 10000 |
+-----------------------------------+
1 row in set (0.00 sec)
'D > MySQL' 카테고리의 다른 글
MySQL TIME() (0) | 2020.04.03 |
---|---|
MySQL SYSDATE() (0) | 2020.04.03 |
MySQL SUBDATE() (0) | 2020.04.03 |
MySQL STR_TO_DATE() (0) | 2020.04.03 |
MySQL SEC_TO_TIME() (0) | 2020.04.03 |