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.MonthInterval論點的月份。

適用於

另請參閱