Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
setUTCDate() は Date インスタンスのメソッドで、この日時の月内の「日」を協定世界時に基づいて変更します。
任意。「日」を表す 1 から 31 までの間の整数値。
その場で Date オブジェクトを変更し、新しいタイムスタンプを返します。 dateValue が NaN (または undefined など、 NaN に変換されるその他の値)の場合、日付は無効な日時に設定され、 NaN が返されます。
もし dateValue がその月の日付値の範囲外だった場合、 setDate() は Date オブジェクトをそれに応じて更新します。
例えば、 dateValue に 0 が指定された場合、日付は前月の最終日に設定されます。もし dateValue に 40 を使用した場合、Date オブジェクトに格納されている月が 6 月であれば、日は 10 に変更され、月は 7 月に増加します。
もし dateValue に負の数が指定された場合、日付は前月の最終日から逆算して設定されます。 -1 の場合、日付は前月の最終日の 1 日前に設定されます。
| ECMAScript® 2027 Language Specification # sec-date.prototype.setutcdate |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年6月18日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.