Export (0) Print
Expand All

DateAndTime.MonthName Method

Returns a String value containing the name of the specified month.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public static string MonthName(
	int Month,
	bool Abbreviate
)

Parameters

Month
Type: System.Int32

Required. Integer. The numeric designation of the month, from 1 through 13; 1 indicates January and 12 indicates December. You can use the value 13 with a 13-month calendar. If your system is using a 12-month calendar and Month is 13, MonthName returns an empty string.

Abbreviate
Type: System.Boolean

Optional. Boolean value that indicates if the month name is to be abbreviated. If omitted, the default is False, which means the month name is not abbreviated.

Return Value

Type: System.String
Returns a String value containing the name of the specified month.

ExceptionCondition
ArgumentException

Month is less than 1 or greater than 13.

The string returned by MonthName depends not only on the input arguments, but also on the Regional Options settings specified in the Windows Control Panel.

NoteNote

MonthName uses the current calendar setting from the CurrentCulture property of the CultureInfo class in the System.Globalization namespace. The default CurrentCulture values are determined by Control Panel settings.

This example uses the MonthName function to determine the name of the month, by the integer given. The Boolean value will determine whether the full name (False) or the abbreviated name (True) will be displayed.

Dim thisMonth As Integer 
Dim name As String
thisMonth = 4
' Set Abbreviate to True to return an abbreviated name.
name = MonthName(thisMonth, True)
' name now contains "Apr".

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft