aboutsummaryrefslogtreecommitdiff
path: root/files/fr/web/javascript/reference/global_objects/date/getdate/index.md
blob: 6be217798e4f7bf3e1883524b22baa308ff14c97 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
---
title: Date.prototype.getDate()
slug: Web/JavaScript/Reference/Global_Objects/Date/getDate
tags:
  - Date
  - JavaScript
  - Méthode
  - Prototype
  - Reference
translation_of: Web/JavaScript/Reference/Global_Objects/Date/getDate
original_slug: Web/JavaScript/Reference/Objets_globaux/Date/getDate
---
{{JSRef}}

La méthode **`getDate()`** retourne le jour du mois pour la date spécifiée d'après l'heure locale.

{{EmbedInteractiveExample("pages/js/date-getdate.html")}}

## Syntaxe

    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 {{jsxref("Date")}} `Noel95`.

```js
var Noel95 = new Date("December 25, 1995 23:15:00");
var jour = Noel95.getDate();

console.log(jour); // 25
```

## Spécifications

| Spécification                                                                                                | État                         | Commentaires                                          |
| ------------------------------------------------------------------------------------------------------------ | ---------------------------- | ----------------------------------------------------- |
| {{SpecName('ESDraft', '#sec-date.prototype.getdate', 'Date.prototype.getDate')}} | {{Spec2('ESDraft')}} |                                                       |
| {{SpecName('ES6', '#sec-date.prototype.getdate', 'Date.prototype.getDate')}}         | {{Spec2('ES6')}}         |                                                       |
| {{SpecName('ES5.1', '#sec-15.9.5.14', 'Date.prototype.getDate')}}                     | {{Spec2('ES5.1')}}     |                                                       |
| {{SpecName('ES1')}}                                                                                     | {{Spec2('ES1')}}         | Définition initiale. Implémentée avec JavaScript 1.1. |

## Compatibilité des navigateurs

{{Compat("javascript.builtins.Date.getDate")}}

## Voir aussi

- {{jsxref("Date.prototype.getUTCDate()")}}
- {{jsxref("Date.prototype.getUTCDay()")}}
- {{jsxref("Date.prototype.setDate()")}}