Movatterモバイル変換


[0]ホーム

URL:


  1. 開発者向けのウェブ技術
  2. JavaScript
  3. JavaScript リファレンス
  4. 標準組み込みオブジェクト
  5. Date
  6. Date.prototype.getDate()

このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docsコミュニティーについてもっと知り、仲間になるにはこちらから。

View in EnglishAlways switch to English

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 ⁨2015年7月⁩.

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

試してみましょう

const birthday = new Date("August 19, 1975 23:15:30");const date1 = birthday.getDate();console.log(date1);// 予想される結果: 19

構文

js
getDate()

引数

なし。

返値

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

getDate() の使用

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

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

仕様書

Specification
ECMAScript® 2026 Language Specification
# sec-date.prototype.getdate

ブラウザーの互換性

関連情報

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp