A RetroSearch Logo

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

Search Query:

Showing content from https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Date/getDate below:

Date.prototype.getDate() - JavaScript | MDN

Date.prototype.getDate()

Baseline Widely available

getDate() は Date インスタンスのメソッドで、地方時に基づき、この日付の「日」を返します。

試してみましょう
const birthday = new Date("August 19, 1975 23:15:30");
const date1 = birthday.getDate();

console.log(date1);
// 予想される結果: 19
構文 引数

なし。

返値

1 から 31 までの間の整数値。地方時に基づき、指定された日時の「日」を表します。日時が無効な場合は NaN を返します。

例 getDate() の使用

以下の 2 行目の文は、Date オブジェクトである xmas95 の値に基づき、変数 day に 25 という値を代入します。

const xmas95 = new Date("1995-12-25T23:15:30");
const day = xmas95.getDate();

console.log(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