SQL 튜토리얼

SQL 홈 SQL 소개 SQL 구문 SQL 선택 SQL 선택 고유 SQL 어디에 SQL 및, 또는, 아님 SQL 순서 SQL 삽입 SQL Null 값 SQL 업데이트 SQL 삭제 SQL 상위 선택 SQL 최소 및 최대 SQL 개수, 평균, 합계 SQL 좋아요 SQL 와일드카드 SQL 입력 SQL 사이 SQL 별칭 SQL 조인 SQL 내부 조인 SQL 왼쪽 조인 SQL 권한 조인 SQL 전체 조인 SQL 자체 조인 SQL 유니온 SQL 그룹화 기준 SQL SQL 존재 모든 SQL SQL 선택 대상 선택에 SQL 삽입 SQL 케이스 SQL 널 함수 SQL 저장 프로시저 SQL 주석 SQL 연산자

SQL 데이터베이스

SQL DB 생성 SQL 삭제 DB SQL 백업 DB SQL 테이블 생성 SQL 삭제 테이블 SQL 변경 테이블 SQL 제약 조건 SQL이 널이 아님 SQL 고유 SQL 기본 키 SQL 외래 키 SQL 확인 SQL 기본값 SQL 인덱스 SQL 자동 증분 SQL 날짜 SQL 보기 SQL 주입 SQL 호스팅 SQL 데이터 유형

SQL 참조

SQL 키워드 MySQL 함수 SQL 서버 기능 MS 액세스 기능 SQL 빠른 참조

SQL 예제

SQL 예제 SQL 퀴즈 SQL 연습 SQL 인증서

MySQL DATE_FORMAT() 함수

❮ MySQL 기능

예시

날짜 형식 지정:

SELECT DATE_FORMAT("2017-06-15", "%Y");

정의 및 사용

DATE_FORMAT() 함수는 지정된 날짜 형식을 지정합니다.

통사론

DATE_FORMAT(date, format)

매개변수 값

Parameter Description
date Required. The date to be formatted
format Required. The format to use. Can be one or a combination of the following values:
Format Description
%a Abbreviated weekday name (Sun to Sat)
%b Abbreviated month name (Jan to Dec)
%c Numeric month name (0 to 12)
%D Day of the month as a numeric value, followed by suffix (1st, 2nd, 3rd, ...)
%d Day of the month as a numeric value (01 to 31)
%e Day of the month as a numeric value (0 to 31)
%f Microseconds (000000 to 999999)
%H Hour (00 to 23)
%h Hour (00 to 12)
%I Hour (00 to 12)
%i Minutes (00 to 59)
%j Day of the year (001 to 366)
%k Hour (0 to 23)
%l Hour (1 to 12)
%M Month name in full (January to December)
%m Month name as a numeric value (00 to 12)
%p AM or PM
%r Time in 12 hour AM or PM format (hh:mm:ss AM/PM)
%S Seconds (00 to 59)
%s Seconds (00 to 59)
%T Time in 24 hour format (hh:mm:ss)
%U Week where Sunday is the first day of the week (00 to 53)
%u Week where Monday is the first day of the week (00 to 53)
%V Week where Sunday is the first day of the week (01 to 53). Used with %X
%v Week where Monday is the first day of the week (01 to 53). Used with %x
%W Weekday name in full (Sunday to Saturday)
%w Day of the week where Sunday=0 and Saturday=6
%X Year for the week where Sunday is the first day of the week. Used with %V
%x Year for the week where Monday is the first day of the week. Used with %v
%Y Year as a numeric, 4-digit value
%y Year as a numeric, 2-digit value

기술적 세부 사항

작동: MySQL 4.0에서

더 많은 예

예시

날짜 형식 지정:

SELECT DATE_FORMAT("2017-06-15", "%M %d %Y");

예시

날짜 형식 지정:

SELECT DATE_FORMAT("2017-06-15", "%W %M %e %Y");

예시

날짜 형식 지정:

SELECT DATE_FORMAT(BirthDate, "%W %M %e %Y") FROM Employees;

❮ MySQL 기능