From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../global_objects/date/setutcmonth/index.html | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 files/ja/web/javascript/reference/global_objects/date/setutcmonth/index.html (limited to 'files/ja/web/javascript/reference/global_objects/date/setutcmonth') diff --git a/files/ja/web/javascript/reference/global_objects/date/setutcmonth/index.html b/files/ja/web/javascript/reference/global_objects/date/setutcmonth/index.html new file mode 100644 index 0000000000..671b969014 --- /dev/null +++ b/files/ja/web/javascript/reference/global_objects/date/setutcmonth/index.html @@ -0,0 +1,77 @@ +--- +title: Date.prototype.setUTCMonth() +slug: Web/JavaScript/Reference/Global_Objects/Date/setUTCMonth +tags: + - Date + - JavaScript + - Method + - Prototype + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setUTCMonth +--- +
{{JSRef}}
+ +

setUTCMonth() メソッドは、協定世界時に基づき、指定された日時の「月」を設定します。

+ +
{{EmbedInteractiveExample("pages/js/date-setutcseconds.html")}}
+ + + +

構文

+ +
dateObj.setUTCMonth(monthValue[, dayValue])
+ +

引数

+ +
+
monthValue
+
1 月から 12 月を表す 0 から 11 までの間の整数値。
+
dayValue
+
任意。「日」を表す 1 から 31 までの間の整数値。
+
+ +

返値

+ +

協定世界時 (UTC) 1970 年 1 月 1 日 00:00:00 から更新された日時までの間のミリ秒単位の数値。

+ +

解説

+ +

dayValue 引数を指定しない場合、{{jsxref("Date.prototype.getUTCDate()", "getUTCDate()")}} メソッドから返される値が使われます。

+ +

指定した値が期待される日時の範囲外の場合、それに応じて setUTCMonth() が {{jsxref("Date")}} オブジェクトの日付情報の更新を試みます。例えば、monthValue に 15 を指定した場合、年に 1 が加算され、月が 3 になります。

+ +

+ +

setUTCMonth() の使用

+ +
var theBigDay = new Date();
+theBigDay.setUTCMonth(11);
+
+ +

仕様書

+ + + + + + + + + + + + +
仕様書
{{SpecName('ESDraft', '#sec-date.prototype.setutcmonth', 'Date.prototype.setUTCMonth')}}
+ +

ブラウザーの互換性

+ + + +

{{Compat("javascript.builtins.Date.setUTCMonth")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf