DateAndTime.Month(DateTime) メソッド

定義

年の月を表す 1 ~ 12 の整数値を返します。

public:
 static int Month(DateTime DateValue);
public static int Month(DateTime DateValue);
static member Month : DateTime -> int
Public Function Month (DateValue As DateTime) As Integer

パラメーター

DateValue
DateTime

必須。 月を抽出する Date 値。

返品

年の月を表す 1 ~ 12 の整数値。

この例では、 Month 関数を使用して、指定した日付から月を取得します。 開発環境では、日付リテラルはコードのロケール設定を使用して、短い日付の書式設定で表示されます。

Dim thisDate As Date
Dim thisMonth As Integer
thisDate = #2/12/1969#
thisMonth = Month(thisDate)
' thisMonth now contains 2.

注釈

DatePartを呼び出し、DateInterval.Month引数にIntervalを指定することで、年の月を取得することもできます。

適用対象

こちらもご覧ください