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 到 31 之間 (含) 整數的 Variant (Integer),代表月份中的日期。

語法

日 ( 日期 )

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

附註: 如果 Calendar 屬性 設定為公曆,傳回的整數代表日期自變數的公曆月份日期。 如果行事曆是回歷,則傳回的整數代表日期自變數的月中的回曆日。

查詢範例

Expression

結果​​

SELECT DateofSale, Day ([DateofSale]) AS Expr1 FROM ProductSales;

傳回 「DateofSale」 字段的值,以及代表這些日期值 「日」的數位。

SELECT Day (#10/11/2018#) AS DayTest FROM ProductSales;

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

VBA 範例

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

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

Dim MyDate, MyDay
MyDate = #February 12, 1969# ' Assign a date.
MyDay = Day(MyDate) ' MyDay contains 12.

選擇正確的日期函數

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!

×