< 사용법 >
SELECT DATE_FORMAT(date, 매개변수);
< 매개변수 >
사용 빈도가 높은 매개변수는 하이라이트 처리
No. | 단위 | 형식 | 내용 |
1 | 연 | %X | Year for the week where Sunday is the first day of the week. Used with %V |
2 | 연 | %x | Year for the week where Monday is the first day of the week. Used with %v |
3 | 연 | %Y | Year as a numeric, 4-digit value |
4 | 연 | %y | Year as a numeric, 2-digit value |
5 | 월 | %b | Abbreviated month name (Jan to Dec) |
6 | 월 | %c | Numeric month name (0 to 12) |
7 | 월 | %M | Month name in full (January to December) |
8 | 월 | %m | Month name as a numeric value (00 to 12) |
9 | 주 | %U | Week where Sunday is the first day of the week (00 to 53) |
10 | 주 | %u | Week where Monday is the first day of the week (00 to 53) |
11 | 주 | %V | Week where Sunday is the first day of the week (01 to 53). Used with %X |
12 | 주 | %v | Week where Monday is the first day of the week (01 to 53). Used with %x |
13 | 일 | %D | Day of the month as a numeric value, followed by suffix (1st, 2nd, 3rd, ...) |
14 | 일 | %d | Day of the month as a numeric value (01 to 31) |
15 | 일 | %e | Day of the month as a numeric value (0 to 31) |
16 | 일 | %j | Day of the year (001 to 366) |
17 | 요일 | %a | Abbreviated weekday name (Sun to Sat) |
18 | 요일 | %W | Weekday name in full (Sunday to Saturday) |
19 | 요일 | %w | Day of the week where Sunday=0 and Saturday=6 |
20 | 오전/오후 | %p | AM or PM |
21 | 오전/오후 | %r | Time in 12 hour AM or PM format (hh:mm:ss AM/PM) |
22 | 시간 | %H | Hour (00 to 23) |
23 | 시간 | %h | Hour (00 to 12) |
24 | 시간 | %I | Hour (00 to 12) |
25 | 시간 | %k | Hour (0 to 23) |
26 | 시간 | %l | Hour (1 to 12) |
27 | 시간 | %T | Time in 24 hour format (hh:mm:ss) |
28 | 분 | %i | Minutes (00 to 59) |
29 | 초 | %S | Seconds (00 to 59) |
30 | 초 | %s | Seconds (00 to 59) |
31 | 초 | %f | Microseconds (000000 to 999999) |
'[분석] SQL' 카테고리의 다른 글
Error_Note (0) | 2024.04.25 |
---|---|
[문법] WITH, WITH RECURSIVE 구문 (0) | 2024.04.24 |
[프로그래머스] 조건에 부합하는 중고거래 댓글 조회하기 (0) | 2024.04.23 |
[프로그래머스] 오프라인/온라인 판매 데이터 통합하기 (UNION) (0) | 2024.04.23 |
[프로그래머스] 그룹별 조건에 맞는 식당 목록 출력하기 (0) | 2024.04.23 |