Skip to main content

MONTH

Returns the month, a number from 1 (January) to 12 (December).

Syntax​

expression.MONTH(arg1-);

expression - A variable that represents a ApiWorksheetFunction class.

Parameters​

NameRequired/OptionalData typeDefaultDescription
arg1-RequiredApiRange | ApiName | numberA number in the date-time code.

Returns​

number

Example​

Extract the month component from a date in a spreadsheet.

// What month does a date represent in a spreadsheet?

// Get the month as a number from a date in a spreadsheet.

const worksheet = Api.GetActiveSheet();

let func = Api.WorksheetFunction;
let ans = func.MONTH("3/16/2018");

worksheet.GetRange("C1").SetValue(ans);