This documentation is archived and is not being maintained.
Month Function (Visual Basic)
value from 1 through 12 representing the month of the year. Integer
Public Function Month(ByVal DateValue As DateTime) As Integer
value from which you want to extract the month. Date
You can also obtain the month of the year by calling
and specifying DatePart for the DateInterval.Month Interval argument.
This example uses the
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. Month
Dim thisDate As Date
Dim thisMonth As Integer
thisDate = #2/12/1969#
thisMonth = Month(thisDate)
' thisMonth now contains 2.
Namespace: Microsoft.VisualBasic Module: DateAndTime Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)