Get to know MDN better
This page was translated from English by the community. Learn more and join the MDN Web Docs community.
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015년 7월.
toString() 메서드는 Date 객체의 시간을 문자열로 반환합니다.
주어진 날짜를 나타내는 문자열.
Date 객체는 toString() 메서드를 Object.prototype이 아닌 Date.prototype에서 상속받습니다. Date.prototype.toString()의 반환값은 ECMA-262에 명시되어있으며 다음과 같이 요약할 수 있습니다.
요일: 세 글자 영어 요일명. 예: "Sat"
공백
월: 세 글자 영어 월 이름. 예: "Sep"
공백
일: 두 글자 숫자. 예: "01"
공백
연: 네 글자 숫자. 예: "2018"
공백
시: 두 글자 숫자. 예: "14"
콜론
분: 두 글자 숫자. 예: "53"
콜론
초: 두 글자 숫자. 예: "26"
공백
문자열 "GMT"
시간대 차이의 부호.
두 글자 숫자로 표현한 시 차이. 예: "14"
두 글자 숫자로 표현한 분 차이. 예: "00"
선택사항: 다음으로 구성한 시간대의 이름.
예: "Sat Sep 01 2018 14:53:26 GMT+0900 (KST)"
ECMAScript 2018(제9판) 전까지 toString()의 반환 형식은 구현에 따라 다를 수 있었습니다. 따라서 특정 형식에 의존하지 않아야 합니다.
toString() 메서드는 날짜를 문자열로 표현해야 할 때 자동으로 쓰입니다. console.log(new Date())와 const today = 'Today is ' + new Date() 등의 경우를 예로 들 수 있습니다.
toString()은 제네릭 메서드로 this의 값이 Date일 필요는 없습니다. 그러나 내부적으로 [[TimeValue]] 속성이 필요한데, 이는 JavaScript로는 설정할 수 없어 결국 사용이 Date 인스턴스로 제한됩니다. Date 외의 다른 객체에서 호출하면 TypeError가 발생합니다.
| ECMAScript® 2027 Language Specification # sec-date.prototype.tostring |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025년 6월 24일 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.