Month Function
Returns a whole number between 1 and 12, inclusive, representing the month of the year.
Syntax
Month(date)
Arguments:
Date: Required. Any expression that can represent a date.
Supported Date Formats:
MM-DD-YYYY
MM/DD/YYYY
DD-MM-YYYY
DD/MM/YYYY
YYYY-MM-DD
YYYY/MM/DD
Remarks
he following example uses the Month
function to return the current
month:
Example 1:
Dim MyVar
MyVar = Month(Now)
'Output: If current month is January, then it returns 1
Example 2:
Dim MyDate, MyMonth
MyDate = "21/01/2025"
MyMonth = Month(MyDate)
'Output: 1 (January)
Example 3:
Dim MyDate1, MyMonth1
MyDate1 = DateAdd("m", 5, "21/01/2025")
MyMonth1 = Month(MyDate1)
'Output: 6 (June)
Example 4:
Dim MyDateTime2, MyMonth2
MyDateTime2 = "21/01/2025 18:45:30" ' Date-Time value.
MyMonth2 = Month(MyDateTime2) ' Returns the month part of the date-time value.
'Output: 1 (January)