일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 Functions and Date Operators
- Date and Time Functions
- HTTP
- Sring Functions and Operators
- 티베로
- String Functions and Operators
- MySQL
- 전자정부표준프레임워크
- Oracle
- String Function and Operators
- Tibero
- Data and Time Functions
- SVN
- 방화벽
- Today
- Total
웹이야기
MySQL MONTH() 본문
MySQL 날짜함수, 시간함수
MONTH()
- 주어진 날짜로부터 월을 구해준다.
MONTH(date)
의 형태로 사용
Returns the month for date, in the range 1 to 12 for January to December, or 0 for dates such as '0000-00-00' or '2008-00-00' that hava a zero month part.
mysql> SELECT MONTH(NOW());
+--------------+
| MONTH(NOW()) |
+--------------+
| 4 |
+--------------+
1 row in set (0.00 sec)
mysql> SELECT MONTH('2020-11-11');
+---------------------+
| MONTH('2020-11-11') |
+---------------------+
| 11 |
+---------------------+
1 row in set (0.00 sec)
mysql> SELECT MONTH('2020-03-50');
+---------------------+
| MONTH('2020-03-50') |
+---------------------+
| NULL |
+---------------------+
1 row in set, 1 warning (0.00 sec)
mysql> SELECT MONTH('2020-03-00');
+---------------------+
| MONTH('2020-03-00') |
+---------------------+
| 3 |
+---------------------+
1 row in set (0.00 sec)
mysql> SELECT MONTH('2020-00-01');
+---------------------+
| MONTH('2020-00-01') |
+---------------------+
| 0 |
+---------------------+
1 row in set (0.00 sec)
'D > MySQL' 카테고리의 다른 글
MySQL NOW() (0) | 2020.04.02 |
---|---|
MySQL MONTHNAME() (0) | 2020.04.02 |
MySQL MINUTE() (0) | 2020.04.02 |
MySQL MICROSECOND() (0) | 2020.04.02 |
MySQL MAKETIME() (0) | 2020.04.02 |