This documentation is archived and is not being maintained.

Month Function

Returns an Integer value from 1 through 12 representing the month of the year.

Public Function Month(ByVal DateValue As DateTime) As Integer


Required. Date value from which you want to extract the month.

You can also obtain the month of the year by calling DatePart and specifying DateInterval.Month for the Interval argument.


This example uses the Month function to obtain the month from a specified date. In the development environment, the date literal is displayed in short date format using the locale settings of your code.

Dim MyDate As Date
Dim MyMonth As Integer
MyDate = #2/12/1969#   ' Assign a date.
MyMonth = Month(MyDate)   ' MyMonth contains 2.


Namespace: Microsoft.VisualBasic

Module: DateAndTime

Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)

See Also

Day Function | Now Property | Weekday Function | Year Function | DatePart Function | System Namespace | DateTime Structure | ArgumentException Class | ArgumentOutOfRangeException Class