MonthName() converts a month number from 1 to 12 into its full or abbreviated name. It uses the current ASP locale, so names can differ by language and regional settings.
<%
Response.Write MonthName(10)
%>
Output in an English locale: October.
MonthName(month[, abbreviate])
| Parameter | Description |
|---|---|
month | Month number, from 1 (January) to 12 (December) |
abbreviate | Optional Boolean: True for short name; False for full name (default) |
MonthName(10)
Returns October under English locale settings.
MonthName(10, False)
The optional False argument requests the full form.
MonthName(10, True)
Returns Oct under English locale settings.
<%
Dim myDate
myDate = DateSerial(2026, 11, 13)
Response.Write MonthName(Month(myDate))
%>
November
This combines Month(), which extracts the numeric month, with MonthName(), which produces the display label.
<%
Dim monthNo
For monthNo = 1 To 12
Response.Write monthNo & ": " & MonthName(monthNo) & "<br>"
Next
%>
This produces January through December under an English locale. It is useful for reports or form dropdown labels.
<%
Dim monthNo
For monthNo = 1 To 12
Response.Write MonthName(monthNo, False) & " (" & _
MonthName(monthNo, True) & ")<br>"
Next
%>
<label for="month">Month</label>
<select name="month" id="month">
<% Dim monthNo
For monthNo = 1 To 12 %>
<option value="<%=monthNo%>"><%=MonthName(monthNo)%></option>
<% Next %>
</select>
Send the numeric value to your server, not the localized label. Always validate submitted values before constructing dates with DateSerial().
<%
Dim previousLocale
previousLocale = SetLocale(1033) ' English (United States)
Response.Write MonthName(3, False)
SetLocale previousLocale
%>
The English result is March. Month names are intended for display; do not use them as stable language-independent identifiers.
A month value outside 1 through 12 is invalid. Validate it before calling MonthName(). To obtain the number from a date use Month(myDate), not MonthName(myDate).
Pass True: MonthName(11, True).
Yes: MonthName(Month(Date)).
No. They depend on the ASP locale.
Use FormatDateTime() with an appropriate named format.
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.