aboutsummaryrefslogtreecommitdiff
path: root/files/ko/conflicting/web/javascript/reference/global_objects/date/index.html
blob: 06e1bba5f7a11cacf21f8c495008bc1257ed719b (plain)
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
---
title: Date.prototype
slug: Web/JavaScript/Reference/Global_Objects/Date/prototype
tags:
  - Date
  - JavaScript
  - Property
  - Prototype
  - Reference
translation_of: Web/JavaScript/Reference/Global_Objects/Date
translation_of_original: Web/JavaScript/Reference/Global_Objects/Date/prototype
---
<div>{{JSRef}}</div>

<p><strong><code>Date.prototype</code></strong> 속성은 {{jsxref("Date")}} 생성자의 프로토타입을 나타냅니다.</p>

<div>{{js_property_attributes(0, 0, 1)}}</div>

<h2 id="설명">설명</h2>

<p>JavaScript {{jsxref("Date")}} 인스턴스는 <code>Date.prototype</code>을 상속합니다. 생성자의 프로토타입을 변경해 모든 <code>Date</code> 인스턴스의 속성과 메서드를 수정할 수 있습니다.</p>

<p>2000년대 달력과의 호환성을 위해 연도는 언제나 완전하게 네 자리 숫자로 작성해야 합니다. 즉 98 대신 1998이 올바른 작성법입니다. <code>Date</code>는 완전한 연도 설정에 도움이 될 {{jsxref("Date.prototype.getFullYear()", "getFullYear()")}}, {{jsxref("Date.prototype.setFullYear()", "setFullYear()")}}, {{jsxref("Date.prototype.getUTCFullYear()", "getUTCFullYear()")}}, {{jsxref("Date.prototype.setUTCFullYear()", "setUTCFullYear()")}} 메서드를 가지고 있습니다.</p>

<p>ECMAScript 6부터 <code>Date.prototype</code>{{jsxref("Date")}} 인스턴스가 아닌 평범한 객체입니다.</p>

<h2 id="속성">속성</h2>

<dl>
 <dt><code>Date.prototype.constructor</code></dt>
 <dd>인스턴스 생성에 사용한 생성자를 반환합니다. 기본값은 {{jsxref("Date")}}입니다.</dd>
</dl>

<h2 id="메서드">메서드</h2>

<h3 id="접근자">접근자</h3>

<dl>
 <dt>{{jsxref("Date.prototype.getDate()")}}</dt>
 <dd>주어진 날짜의 일(1-31)을 현지 시간에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getDay()")}}</dt>
 <dd>주어진 날짜의 요일(0-6)을 현지 시간에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getFullYear()")}}</dt>
 <dd>주어진 날짜의 연도(4자리 수)를 현지 시간에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getHours()")}}</dt>
 <dd>주어진 날짜의 시(0-23)를 현지 시간에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getMilliseconds()")}}</dt>
 <dd>주어진 날짜의 밀리초(0-999)를 현지 시간에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getMinutes()")}}</dt>
 <dd>주어진 날짜의 분(0-59)을 현지 시간에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getMonth()")}}</dt>
 <dd>주어진 날짜의 월(0-11)을 현지 시간에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getSeconds()")}}</dt>
 <dd>주어진 날짜의 초(0-59)를 현지 시간에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getTime()")}}</dt>
 <dd>주어진 날짜와 1970년 1월 1일 0시 0분(UTC)의 차이를 밀리초로 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getTimezoneOffset()")}}</dt>
 <dd>현재 로케일의 시간대 차이를 분으로 환산해 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getUTCDate()")}}</dt>
 <dd>주어진 날짜의 일(1-31)을 UTC에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getUTCDay()")}}</dt>
 <dd>주어진 날짜의 요일(0-6)을 UTC에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getUTCFullYear()")}}</dt>
 <dd>주어진 날짜의 연도(4자리 수)를 UTC에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getUTCHours()")}}</dt>
 <dd>주어진 날짜의 시(0-23)를 UTC에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getUTCMilliseconds()")}}</dt>
 <dd>주어진 날짜의 밀리초(0-999)를 UTC에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getUTCMinutes()")}}</dt>
 <dd>주어진 날짜의 분(0-59)을 UTC에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getUTCMonth()")}}</dt>
 <dd>주어진 날짜의 월(0-11)을 UTC에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getUTCSeconds()")}}</dt>
 <dd>주어진 날짜의 초(0-59)를 UTC에 맞춰 반환합니다.</dd>
 <dt>{{jsxref("Date.prototype.getYear()")}} {{deprecated_inline}}</dt>
 <dd>주어진 날짜의 연도(주로 두세자리 숫자)를 현지 시간에 맞춰 반환합니다. {{jsxref("Date.prototype.getFullYear()", "getFullYear()")}}를 사용하세요.</dd>
</dl>

<h3 id="설정자">설정자</h3>

<dl>
 <dt>{{jsxref("Date.prototype.setDate()")}}</dt>
 <dd>Sets the day of the month for a specified date according to local time.</dd>
 <dt>{{jsxref("Date.prototype.setFullYear()")}}</dt>
 <dd>Sets the full year (e.g. 4 digits for 4-digit years) for a specified date according to local time.</dd>
 <dt>{{jsxref("Date.prototype.setHours()")}}</dt>
 <dd>Sets the hours for a specified date according to local time.</dd>
 <dt>{{jsxref("Date.prototype.setMilliseconds()")}}</dt>
 <dd>Sets the milliseconds for a specified date according to local time.</dd>
 <dt>{{jsxref("Date.prototype.setMinutes()")}}</dt>
 <dd>Sets the minutes for a specified date according to local time.</dd>
 <dt>{{jsxref("Date.prototype.setMonth()")}}</dt>
 <dd>Sets the month for a specified date according to local time.</dd>
 <dt>{{jsxref("Date.prototype.setSeconds()")}}</dt>
 <dd>Sets the seconds for a specified date according to local time.</dd>
 <dt>{{jsxref("Date.prototype.setTime()")}}</dt>
 <dd>Sets the {{jsxref("Date")}} object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC, allowing for negative numbers for times prior.</dd>
 <dt>{{jsxref("Date.prototype.setUTCDate()")}}</dt>
 <dd>Sets the day of the month for a specified date according to universal time.</dd>
 <dt>{{jsxref("Date.prototype.setUTCFullYear()")}}</dt>
 <dd>Sets the full year (e.g. 4 digits for 4-digit years) for a specified date according to universal time.</dd>
 <dt>{{jsxref("Date.prototype.setUTCHours()")}}</dt>
 <dd>Sets the hour for a specified date according to universal time.</dd>
 <dt>{{jsxref("Date.prototype.setUTCMilliseconds()")}}</dt>
 <dd>Sets the milliseconds for a specified date according to universal time.</dd>
 <dt>{{jsxref("Date.prototype.setUTCMinutes()")}}</dt>
 <dd>Sets the minutes for a specified date according to universal time.</dd>
 <dt>{{jsxref("Date.prototype.setUTCMonth()")}}</dt>
 <dd>Sets the month for a specified date according to universal time.</dd>
 <dt>{{jsxref("Date.prototype.setUTCSeconds()")}}</dt>
 <dd>Sets the seconds for a specified date according to universal time.</dd>
 <dt>{{jsxref("Date.prototype.setYear()")}} {{deprecated_inline}}</dt>
 <dd>Sets the year (usually 2-3 digits) for a specified date according to local time. Use {{jsxref("Date.prototype.setFullYear()", "setFullYear()")}} instead.</dd>
</dl>

<h3 id="변환_접근자">변환 접근자</h3>

<dl>
 <dt>{{jsxref("Date.prototype.toDateString()")}}</dt>
 <dd>Returns the "date" portion of the {{jsxref("Date")}} as a human-readable string like 'Thu Apr 12 2018'</dd>
 <dt>{{jsxref("Date.prototype.toISOString()")}}</dt>
 <dd>Converts a date to a string following the ISO 8601 Extended Format.</dd>
 <dt>{{jsxref("Date.prototype.toJSON()")}}</dt>
 <dd>Returns a string representing the {{jsxref("Date")}} using {{jsxref("Date.prototype.toISOString()", "toISOString()")}}. Intended for use by {{jsxref("JSON.stringify()")}}.</dd>
 <dt>{{jsxref("Date.prototype.toGMTString()")}} {{deprecated_inline}}</dt>
 <dd>Returns a string representing the {{jsxref("Date")}} based on the GMT (UT) time zone. Use {{jsxref("Date.prototype.toUTCString()", "toUTCString()")}} instead.</dd>
 <dt>{{jsxref("Date.prototype.toLocaleDateString()")}}</dt>
 <dd>Returns a string with a locality sensitive representation of the date portion of this date based on system settings.</dd>
 <dt>{{jsxref("Date.prototype.toLocaleFormat()")}} {{non-standard_inline}}</dt>
 <dd>Converts a date to a string, using a format string.</dd>
 <dt>{{jsxref("Date.prototype.toLocaleString()")}}</dt>
 <dd>Returns a string with a locality sensitive representation of this date. Overrides the {{jsxref("Object.prototype.toLocaleString()")}} method.</dd>
 <dt>{{jsxref("Date.prototype.toLocaleTimeString()")}}</dt>
 <dd>Returns a string with a locality sensitive representation of the time portion of this date based on system settings.</dd>
 <dt>{{jsxref("Date.prototype.toSource()")}} {{non-standard_inline}}</dt>
 <dd>Returns a string representing the source for an equivalent {{jsxref("Date")}} object; you can use this value to create a new object. Overrides the {{jsxref("Object.prototype.toSource()")}} method.</dd>
 <dt>{{jsxref("Date.prototype.toString()")}}</dt>
 <dd>Returns a string representing the specified {{jsxref("Date")}} object. Overrides the {{jsxref("Object.prototype.toString()")}} method.</dd>
 <dt>{{jsxref("Date.prototype.toTimeString()")}}</dt>
 <dd>Returns the "time" portion of the {{jsxref("Date")}} as a human-readable string.</dd>
 <dt>{{jsxref("Date.prototype.toUTCString()")}}</dt>
 <dd>Converts a date to a string using the UTC timezone.</dd>
 <dt>{{jsxref("Date.prototype.valueOf()")}}</dt>
 <dd>Returns the primitive value of a {{jsxref("Date")}} object. Overrides the {{jsxref("Object.prototype.valueOf()")}} method.</dd>
</dl>

<h2 id="명세">명세</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('ES1')}}</td>
   <td>{{Spec2('ES1')}}</td>
   <td>Initial definition. Implemented in JavaScript 1.1.</td>
  </tr>
  <tr>
   <td>{{SpecName('ES5.1', '#sec-15.9.5', 'Date.prototype')}}</td>
   <td>{{Spec2('ES5.1')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('ES6', '#sec-properties-of-the-date-prototype-object', 'Date.prototype')}}</td>
   <td>{{Spec2('ES6')}}</td>
   <td> </td>
  </tr>
  <tr>
   <td>{{SpecName('ESDraft', '#sec-properties-of-the-date-prototype-object', 'Date.prototype')}}</td>
   <td>{{Spec2('ESDraft')}}</td>
   <td> </td>
  </tr>
 </tbody>
</table>

<h2 id="브라우저_호환성">브라우저 호환성</h2>

<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>

<p>{{Compat("javascript.builtins.Date.prototype")}}</p>