Date.prototype.getSeconds()

 

Il metodo getSeconds() restituisce i secondi nella data specificata in accordo con l'ora locale.

Sintassi

dateObj.getSeconds()

Valore di ritorno

Un numero di tipo integer, tra 0 e 59, rappresentante i secondi nella data fonita in accordo con l'ora locale.

Esempi

Utilizzando  getSeconds()

La seconda dichiarazione qui sotto assegna il valore  30 alla variabile seconds, basata sul valore dell'oggetto Date Xmas95.

var Xmas95 = new Date('December 25, 1995 23:15:30');
var seconds = Xmas95.getSeconds();

console.log(seconds); // 30

Specificazioni

Specification Status Comment
ECMAScript 1st Edition (ECMA-262) Standard Definizione iniziale. Implementata 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  

Browser compatibility

Update compatibility data on GitHub
DesktopMobileServer
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung InternetNode.js
getSecondsChrome Full support YesEdge Full support 12Firefox Full support 1IE Full support YesOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 4Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yesnodejs Full support Yes

Legend

Full support  
Full support

See also