Date.prototype.getDate()
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.
La méthode getDate()
retourne le jour du mois pour la date spécifiée d'après l'heure locale.
Exemple interactif
const birthday = new Date("August 19, 1975 23:15:30");
const date1 = birthday.getDate();
console.log(date1);
// Expected output: 19
Syntaxe
js
dateObj.getDate();
Paramètres
Aucun.
Valeur de retour
Un entier entre 1 et 31 correspondant au jour du mois de la date indiquée selon l'heure locale.
Exemples
Utiliser getDate()
La seconde instruction ci-dessous affecte la valeur 25 à la variable jour
, d'après la valeur de l'objet Date
Noel95
.
js
var Noel95 = new Date("December 25, 1995 23:15:00");
var jour = Noel95.getDate();
console.log(jour); // 25
Spécifications
Specification |
---|
ECMAScript® 2025 Language Specification # sec-date.prototype.getdate |
Compatibilité des navigateurs
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getDate |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on 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.