[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Date/getSeconds [Back]  [Original]

Date.prototype.getSeconds() - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

Date.prototype.getSeconds()

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 20157.

Date getSeconds()

In this article

const moonLanding = new Date("July 20, 69 00:20:18");

console.log(moonLanding.getSeconds());
// 18

js
getSeconds()

0 59 NaN

getSeconds()

seconds 30 Date xmas95

js
const xmas95 = new Date("1995-12-25T23:15:30");
const seconds = xmas95.getSeconds();

console.log(seconds); // 30

Specification
ECMAScript 2027 LanguageSpecification
# sec-date.prototype.getseconds


Web Proxy Viewer  |  New URL  |  Original Page