Il metodo getDate()
resituisce il giorno del mese per la data specificata in accordo con l'ora locale.
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.
Sintassi
dateObj.getDate()
Valore di ritorno
Un numero integer, tra 1 e 31, rappresentante il giorno del mese per la data fornita in accordo con l'ora locale.
Esempi
Utilizzando getDate()
La seconda dichiarazione qui sotto assegna il valore 25 alla variabile day
, basata sul valore dell'oggetto Date
Xmas95
.
var Xmas95 = new Date('December 25, 1995 23:15:30');
var day = Xmas95.getDate();
console.log(day); // 25
Specificazioni
Specification | Status | Comment |
---|---|---|
ECMAScript (ECMA-262) The definition of 'Date.prototype.getDate' in that specification. |
Living Standard | |
ECMAScript 2015 (6th Edition, ECMA-262) The definition of 'Date.prototype.getDate' in that specification. |
Standard | |
ECMAScript 5.1 (ECMA-262) The definition of 'Date.prototype.getDate' in that specification. |
Standard | |
ECMAScript 1st Edition (ECMA-262) | Standard | Definizione iniziale. Implementata in JavaScript 1.1. |
Browser compatibility
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.