valueOf()
함수는 Date
객체의 원시값을 반환합니다.
Syntax
dateObj.valueOf()
Return value
반환되는 milliseconds 값은 1 January 1970 00:00:00 UTC 와 주어진 일시 사이의 값입니다.
Description
valueOf()
함수는 01 January, 1970 UTC 이후의 milliseconds 단위의 자연수 타입인 Date
객체의 원시값을 반환합니다.
이 함수는 Date.prototype.getTime()
함수와 동일한 결과값을 반환합니다.
이 함수는 사용자 코드에 명시된 것이 아닌, JavaScript 자체에 포함되어 있습니다.
Examples
Using valueOf()
var x = new Date(56, 6, 17);
var myVar = x.valueOf(); // myVar에 -424713600000를 할당합니다.
Specifications
Specification | Status | Comment |
---|---|---|
ECMAScript 1st Edition (ECMA-262) | Standard | 최초 정의. JavaScript 1.1에서 구현 |
ECMAScript 5.1 (ECMA-262) The definition of 'Date.prototype.valueOf' in that specification. |
Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Date.prototype.valueOf' in that specification. |
Standard | |
ECMAScript (ECMA-262) The definition of 'Date.prototype.valueOf' in that specification. |
Living Standard |
Browser compatibility
BCD tables only load in the browser
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.