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.
Сводка
Метод getDate()
возвращает день месяца указанной даты по местному времени.
Синтаксис
dateObj.getDate()
Параметры
Нет.
Возвращаемое значение
Значение, возвращённое методом getDate()
, является целым числом от 1 до 31.
Примеры
Пример: использование метода getDate()
Вторая инструкция в примере ниже присваивает значение 25 переменной day
из значения объекта Date
date
.
js
let date = new Date("December 25, 1995 23:15:30");
let day = date.getDate();
console.log(day); // 25
Спецификации
Specification |
---|
ECMAScript® 2025 Language Specification # sec-date.prototype.getdate |
Совместимость с браузерами
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.