Choose where you’d like to start

month()

Overview

The month() function takes a dateTimeValue as an argument and returns the numerical value of the month.

Return Type

  • Number

Syntax

<variable> = <dateTimeValue>.month();

(OR)

<variable> = month(<dateTimeValue>);

(OR)

<variable> = <dateTimeValue>.getMonth();

(OR)

<variable> = getMonth(<dateTimeValue>);
ParameterDescriptionData type
<variable>Variable which will contain the returned number.NUMBER
<dateTimeValue>

The date-time value from which the month's numerical value will be returned.

A runtime error will be encountered if:

  • the specified 2 digit date value exceeds the number of days in that month.
  • an incorrect month value is specified in 3 or more characters.

The function returns a null value if:

  • the month value is specified in less than 3 characters.
  • the hour value, or the minutes value, or the seconds value is specified in more than 2 digits.
  • the date value is specified in more than 2 digits.
  • the year value has more than 4 digits.

Please refer this help document to learn about the supported date-time formats.

DATE-TIME

Examples

currentDate = '14-Dec-2023';
monthNumber = currentDate.month();
info monthNumber; //Returns 12

Get Started Now

Execute