Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

傳回指定 1 到 12 之間 (包括 1 和 12) 的整數之 Variant (Integer),代表一年之中的月份。

語法

月份 ( 日期 )

必要 日期引數 是任何 Variant、 數值運算式、 字串運算式,或是任何可以代表日期的組合。 如果 date 包含 Null,就會傳回 Null

附註: 如果 Calendar 屬性 設定為公曆,傳回的整數代表日期自變數的公曆星期幾。 如果行事曆是回歷,傳回的整數代表日期自變數的每周回歷日。 對於回歷日期,自變數數位是任何可代表公曆 1/1/100 (公曆 718 年) 8 月 2 日到 4/3/9666 的數值表達式, (公曆 9999 年 12 月 31 日) 。

查詢範例

Expression

結果​​

SELECT Month (#10/10/2018#) AS MonthTest FROM ProductSales;

傳回代表 「2018/10/10」 字串之 「month」 的數位。 結果:10。

VBA 範例

附註: 下列範例示範如何在 Visual Basic for Applications (VBA) 模組中使用此函數。 如需使用 VBA 的詳細資訊,請在 [搜尋] 旁的下拉式清單中選取 [開發人員參考],並在 [搜尋] 方塊中輸入一個或多個字詞。

此範例使用 Month 函數從指定的日期取得月份。 在開發環境中,日期常值會使用程式代碼的區域設定,以簡短的日期格式顯示。

Dim MyDate, MyMonth
MyDate = #February 12, 1969# ' Assign a date.
MyMonth = Month(MyDate) ' MyMonth contains 2.

選擇正確的日期函數

Need more help?

Want more options?

探索訂閱權益、瀏覽訓練課程、瞭解如何保護您的裝置等等。

社群可協助您詢問並回答問題、提供意見反應,以及聆聽來自具有豐富知識的專家意見。

Was this information helpful?

How satisfied are you with the translation quality?
What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×