★ wanayoo — archive 1999 https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Date/setMonthNouvelle recherche | Portail wanayoo

Date.prototype.setMonth()

by 1 contributor:

This article is in need of an editorial review.

This translation is incomplete. Please help translate this article from English.

概要

現在の設定年に基づき、指定された日時の「月」を設定します。

構文

dateObj.setMonth(monthValue[, dayValue])

Versions prior to JavaScript 1.3

dateObj.setMonth(monthValue)

引数

monthValue
1月から12月を表す0から11までの整数値
dayValue
オプション. 「日」を表す、1から31までの整数値

説明

dayValue引数を指定しない場合、getDate()メソッドから返される値が使われます。

指定するパラメータが期待値の範囲外の場合、 setMonth() はDateオブジェクトの日時情報を更新しようとします。例えば、monthValueに15を指定した場合、年は1繰り上げられ、「月」は3になります。

例

例: setMonth()を使う

var theBigDay = new Date();
theBigDay.setMonth(6);

仕様

仕様 ステータス コメント
ECMAScript 1st Edition. Standard Initial definition. Implemented in JavaScript 1.0.
ECMAScript 5.1 (ECMA-262)
The definition of 'Date.prototype.setMonth' in that specification.
Standard  
ECMAScript 6 (ECMA-262)
The definition of 'Date.prototype.setMonth' in that specification.
勧告候補  

ブラウザ実装状況

機能 Chrome Firefox (Gecko) Internet Explorer Opera Safari
基本サポート (有) (有) (有) (有) (有)
機能 Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
基本サポート (有) (有) (有) (有) (有) (有)

関連情報

ドキュメントのタグと貢献者

Contributors to this page: shide55
最終更新者: shide55,
サイドバーを隠す