Date.prototype.getSeconds()
O método getSeconds()
retorna os segundos de uma data específica de acordo com o horário local.
Sintaxe
dateObj.getSeconds()
Retorna
Um número inteiro, entre 0 e 59, representando os segundos de uma data específica de acordo com o horário local.
Exemples
Usando o getSeconds()
The second statement below assigns the value 30 to the variable seconds
, based on the value of the Date
object Xmas95
.
No exemplo a seguir, a segunda linha atribui o valor 30 à variável seconds
, baseado no valor do objeto Date
Xmas95
.
js
var Xmas95 = new Date("December 25, 1995 23:15:30");
var seconds = Xmas95.getSeconds();
console.log(seconds); // 30
Espeficicações
Specification | Status | Comment |
---|---|---|
ECMAScript 1st Edition (ECMA-262) | Padrão | Definição inicial. Implementado no JavaScript 1.0. |
ECMAScript 5.1 (ECMA-262) The definition of 'Date.prototype.getSeconds' in that specification. |
Padrão | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Date.prototype.getSeconds' in that specification. |
Padrão | |
ECMAScript (ECMA-262) The definition of 'Date.prototype.getSeconds' in that specification. |
Padrão em tempo real |
Compatibilidade com navegadores
BCD tables only load in the browser