--- title: Date.prototype.getSeconds() slug: Web/JavaScript/Reference/Global_Objects/Date/getSeconds translation_of: Web/JavaScript/Reference/Global_Objects/Date/getSeconds ---
Il metodo getSeconds()
restituisce i secondi nella data specificata in accordo con l'ora locale.
dateObj.getSeconds()
Un numero di tipo integer, tra 0 e 59, rappresentante i secondi nella data fonita in accordo con l'ora locale.
getSeconds()
La seconda dichiarazione qui sotto assegna il valore 30 alla variabile seconds
, basata sul valore dell'oggetto {{jsxref("Global_Objects/Date", "Date")}} Xmas95
.
var Xmas95 = new Date('December 25, 1995 23:15:30'); var seconds = Xmas95.getSeconds(); console.log(seconds); // 30
Specification | Status | Comment |
---|---|---|
{{SpecName('ES1')}} | {{Spec2('ES1')}} | Definizione iniziale. Implementata in JavaScript 1.0. |
{{SpecName('ES5.1', '#sec-15.9.5.22', 'Date.prototype.getSeconds')}} | {{Spec2('ES5.1')}} | |
{{SpecName('ES6', '#sec-date.prototype.getseconds', 'Date.prototype.getSeconds')}} | {{Spec2('ES6')}} | |
{{SpecName('ESDraft', '#sec-date.prototype.getseconds', 'Date.prototype.getSeconds')}} | {{Spec2('ESDraft')}} |
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.
{{Compat("javascript.builtins.Date.getSeconds")}}