Skip to content

MONTH function

Note: This draft page is under construction 🚧

Overview

MONTH is a function of the Date and Time category that extracts the month from a valid date serial number, returning a number in the range [1, 12].

Usage

Syntax

MONTH(date) => month

Argument descriptions

  • date (number, required). The date for which the month is to be calculated, expressed as a serial number in the range [1, 2958466). The value 1 corresponds to the date 1899-12-31, while 2958465 corresponds to 9999-12-31.

Additional guidance

If the supplied date argument has a fractional part, MONTH uses its floor value.

Returned value

MONTH returns an integer number in the range [1, 12], that is the month according to the Gregorian calendar. The value 1 corresponds to January, 2 corresponds to February and so on.

Error conditions

  • In common with many other IronCalc functions, MONTH propagates errors that are found in its argument.
  • If no argument, or more than one argument, is supplied, then MONTH returns the #ERROR! error.
  • If the value of the date argument is not (or cannot be converted to) a number, then MONTH returns the #VALUE! error.
  • For some argument values, MONTH may return the #DIV/0! error.
  • If date is less than 1, or greater than or equal to 2,958,466, then MONTH returns the #NUM! error.
  • At present, MONTH does not accept a string representation of a date literal as an argument. For example, the formula =MONTH("2024-12-31") returns the #VALUE! error.
  • For more information about the different types of errors that you may encounter when using IronCalc functions, visit our Error Types page.

Details

IronCalc utilizes Rust's chrono crate to implement the MONTH function.

Examples

See some examples in IronCalc.