You are here: Function Reference > Alphabetical Listing > M > Month

Month

Use this function to determine the number of the month in a given date and return the number.

Syntax

Month (Date, Format, Locale)

Parameter

Description

Date

Enter a valid date string. The system assumes your entry is in the date format specified in the Format parameter. The default is the current date.

Format

Enter a valid date format string that describes the Date parameter. The default is date format 1.

Locale

(Optional) Enter the locale code. If you omit this parameter, the system checks the Locale INI option. If the Locale INI option offers no value, the system defaults to USD (United States/English).

The system determines the month portion of the given date based on the format you specify. This function is often used with the MonthName function.

Example

Here are some examples:

(Assume the current date is 07/01/09.)

Function

Result

Explanation

Month ( )

7

The parameter defaults to the current date.

Month ("09/138", "I")

5

The given date (09/138) in the date format I is the equivalent of May 18, 2009. Therefore the number of the month (5) is returned.

datestring=

DateAdd(, , ,3);

Month(datestring)

10

First the DateAdd function defaults to the current date and adds three months. The resulting date of October 1, 2009 is returned to the target variable datestring. The Month function then returns the number of the month of October (10).

See also