getSeconds()
메서드는 Date
객체의 초 값을 현지 시간에 맞춰 반환합니다.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
구문
dateObj.getSeconds()
반환 값
현지 시간 기준 초를 나타내는 0에서 59 사이의 정수.
예제
getSeconds()
사용하기
다음 예제는 Date
객체 Xmas95
의 값을 사용해 변수 seconds
에 30을 할당합니다.
var Xmas95 = new Date('December 25, 1995 23:15:30'); var seconds = Xmas95.getSeconds(); console.log(seconds); // 30
명세
Specification | Status | Comment |
---|---|---|
ECMAScript 1st Edition (ECMA-262) | Standard | Initial definition. Implemented in JavaScript 1.0. |
ECMAScript 5.1 (ECMA-262) The definition of 'Date.prototype.getSeconds' in that specification. |
Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Date.prototype.getSeconds' in that specification. |
Standard | |
ECMAScript Latest Draft (ECMA-262) The definition of 'Date.prototype.getSeconds' in that specification. |
Draft |
브라우저 호환성
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.
Update compatibility data on GitHub
Desktop | Mobile | Server | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getSeconds | Chrome Full support 1 | Edge Full support 12 | Firefox Full support 1 | IE Full support 4 | Opera Full support Yes | Safari Full support Yes | WebView Android Full support 1 | Chrome Android Full support 18 | Firefox Android Full support 4 | Opera Android Full support Yes | Safari iOS Full support Yes | Samsung Internet Android Full support 1.0 | nodejs Full support Yes |
Legend
- Full support
- Full support