Date.prototype.getUTCSeconds()

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

O método getUTCSeconds() retorna os segundos na data informada de acordo com a hora universal.

Experimente

const moonLanding = new Date("July 20, 1969, 20:18:04 UTC");

console.log(moonLanding.getUTCSeconds());
// Expected output: 4

Sintaxe

dateObj.getUTCSeconds()

Valor de retorno

Um número inteiro, entre 0 e 59, representando os segundos da data informada de acordo com a hora universal.

Exemplos

Usando getUTCSeconds()

The following example assigns the seconds portion of the current time to the variabl

O exemplo a seguir atribui a parte dos segundos da hora atual à variável seconds.

js
var today = new Date();
var seconds = today.getUTCSeconds();

Especificações

Specification
ECMAScript® 2025 Language Specification
# sec-date.prototype.getutcseconds

Compatibilidade com navegadores

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
getUTCSeconds

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Veja também