blob: 778321f74e7f8dc724abf4ac0a5099963087e800 (
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
|
---
title: Date.prototype.valueOf()
slug: Web/JavaScript/Reference/Global_Objects/Date/valueOf
translation_of: Web/JavaScript/Reference/Global_Objects/Date/valueOf
---
<div>{{JSRef}}</div>
<p><strong><code>valueOf()</code></strong> 함수는 {{jsxref("Date")}} 객체의 원시값을 반환합니다.</p>
<div>{{EmbedInteractiveExample("pages/js/date-valueof.html")}}</div>
<h2 id="Syntax">Syntax</h2>
<pre class="syntaxbox"><code><var>dateObj</var>.valueOf()</code></pre>
<h3 id="Return_value">Return value</h3>
<p>반환되는 milliseconds 값은 1 January 1970 00:00:00 UTC 와 주어진 일시 사이의 값입니다.</p>
<h2 id="Description">Description</h2>
<p><code>valueOf()</code> 함수는 01 January, 1970 UTC 이후의 milliseconds 단위의 자연수 타입인 {{jsxref("Date")}} 객체의 원시값을 반환합니다.</p>
<p>이 함수는 {{jsxref("Date.prototype.getTime()")}} 함수와 동일한 결과값을 반환합니다.</p>
<p>이 함수는 사용자 코드에 명시된 것이 아닌, JavaScript 자체에 포함되어 있습니다.</p>
<h2 id="Examples">Examples</h2>
<h3 id="Using_valueOf()">Using <code>valueOf()</code></h3>
<pre class="brush: js">var x = new Date(56, 6, 17);
var myVar = x.valueOf(); // myVar에 -424713600000를 할당합니다.
</pre>
<h2 id="Specifications">Specifications</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>최초 정의. JavaScript 1.1에서 구현</td>
</tr>
<tr>
<td>{{SpecName('ES5.1', '#sec-15.9.5.8', 'Date.prototype.valueOf')}}</td>
<td>{{Spec2('ES5.1')}}</td>
<td></td>
</tr>
<tr>
<td>{{SpecName('ES6', '#sec-date.prototype.valueof', 'Date.prototype.valueOf')}}</td>
<td>{{Spec2('ES6')}}</td>
<td></td>
</tr>
<tr>
<td>{{SpecName('ESDraft', '#sec-date.prototype.valueof', 'Date.prototype.valueOf')}}</td>
<td>{{Spec2('ESDraft')}}</td>
<td></td>
</tr>
</tbody>
</table>
<h2 id="Browser_compatibility">Browser compatibility</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.valueOf")}}</p>
<h2 id="See_also">See also</h2>
<ul>
<li>{{jsxref("Object.prototype.valueOf()")}}</li>
<li>{{jsxref("Date.prototype.getTime()")}}</li>
</ul>
|