A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.cdn.mozilla.net/zh-CN/docs/Web/JavaScript/Reference/Global_Objects/Date/getDate below:

Date.prototype.getDate() - JavaScript | MDN

Date.prototype.getDate()

Baseline Widely available

根据本地时间,返回一个指定的日期对象为一个月中的哪一日(从 1--31)。

尝试一下
const birthday = new Date("August 19, 1975 23:15:30");
const date1 = birthday.getDate();

console.log(date1);
// Expected output: 19
语法 参数

无

描述

getDate() 返回一个 1 到 31 的整数值。

示例 示例:使用 getDate() 方法

下面第二条语句将值 25 赋给 day 变量,该值基于日期对象 Xmax95的值。

var Xmas95 = new Date("December 25, 1995 23:15:00");
var day = Xmas95.getDate();

alert(day); // 25
规范 浏览器兼容性 参见

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4