Name

MonthName Function

Syntax

MonthName monthnumber [, abbreviate]
monthnumber

Use: Required

Data Subtype: Long

The ordinal number of the month, from 1 to 12.

abbreviate

Use: Optional

Data Subtype: Boolean

A flag to indicate whether an abbreviated month name should be returned.

Return Value

A Variant of subtype String.

Description

Returns the month name of a given month. For example, 1 returns January, or if abbreviate is True, Jan.

Rules at a Glance

The default value for abbreviate is False.

Programming Tips & Gotchas

monthnumber must be an integer or a long; it can’t be a date. Use DatePart("m", dateval ) to obtain a month number from a date.

Get VBScript in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.