일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Data and Time Functions
- SVN
- Sring Functions and Operators
- String Functions and Operators
- Date and Time Function
- MySQL
- Date and Time Functions
- Tibero
- 윈도우
- String Function and Operators
- 방화벽
- 티베로
- 전자정부 표준프레임워크
- String Functions and Date Operators
- 전자정부표준프레임워크
- Oracle
- HTTP
- 오라클
- Today
- Total
웹이야기
MySQL LAST_DAY() 본문
MySQL 날짜함수, 시간함수
LAST_DAY()
- 해당 월의 마지막 날짜를 return.
LAST_DAY(date), LAST_DAY(datetime)
의 형태
Takes a date or datetime value and returns the corresponding value for the last day of the month. Return NULL if the argument is invalid.
mysql> SELECT LAST_DAY(NOW());
+-----------------+
| LAST_DAY(NOW()) |
+-----------------+
| 2020-04-30 |
+-----------------+
1 row in set (0.00 sec)
mysql> SELECT LAST_DAY('2018-02-01');
+------------------------+
| LAST_DAY('2018-02-01') |
+------------------------+
| 2018-02-28 |
+------------------------+
1 row in set (0.00 sec)
mysql> SELECT LAST_DAY('2019-02-01 12:13:45');
+---------------------------------+
| LAST_DAY('2019-02-01 12:13:45') |
+---------------------------------+
| 2019-02-28 |
+---------------------------------+
1 row in set (0.00 sec)
mysql> SELECT LAST_DAY('0000-02-01 12:13:45');
+---------------------------------+
| LAST_DAY('0000-02-01 12:13:45') |
+---------------------------------+
| 0000-02-28 |
+---------------------------------+
1 row in set (0.00 sec)
mysql> SELECT LAST_DAY('2020-02-30 12:13:45');
+---------------------------------+
| LAST_DAY('2020-02-30 12:13:45') |
+---------------------------------+
| NULL |
+---------------------------------+
1 row in set, 1 warning (0.00 sec)
'D > MySQL' 카테고리의 다른 글
MySQL MAKEDATE() (0) | 2020.04.02 |
---|---|
MySQL LOCALTIME() (0) | 2020.04.02 |
MySQL HOUR() (0) | 2020.04.02 |
MySQL GET_FORMAT() (0) | 2020.04.02 |
MySQL FROM_UNIXTIME() (0) | 2020.04.02 |