Month Function

依 DateSerial 或 DateValue 函式產生的順序日期,傳回某年中的某月。

語法

Month (Number)

傳回值類型

整型

參數:

Number:數值型表示式,包含用於確定年份中月份的順序日期數。

此函式是 DateSerial 函式的逆運算,它依 DateSerialDateValue 函式所產生的順序日期,傳回某年中的某月。例如,表示式

Print Month(DateSerial(1994, 12, 20))

傳回值為 12。

錯誤代碼:

5 無效的程序呼叫

示例:

Sub ExampleMonth

    MsgBox "" & Month(Now) ,64,"The current month"

End Sub