Метод getSeconds()
повертає секунди у вказаній даті згідно з місцевим часом.
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()
Друга інструкція, наведена нижче, присвоює значення 30 змінній seconds
, на основі значення об'єкта Date
на ім'я Xmas95
.
var Xmas95 = new Date('December 25, 1995 23:15:30');
var seconds = Xmas95.getSeconds();
console.log(seconds); // 30
Специфікації
Специфікація |
---|
ECMAScript (ECMA-262) The definition of 'Date.prototype.getSeconds' in that specification. |
Сумісність з веб-переглядачами
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.