Skip to main content

monthAsNumber

Returns the number for the input month name — e.g. 3 for March.

You can pick which language the function uses by specifying a locale in the second parameter.

The default language is US English.

To perform the reverse operation, use the numberAsMonth function.

Parameters

  • MONTH NAME (string)

    The input month name. You can give the name in full (e.g. 'January') or in abbreviated form (e.g. 'Jan').

  • LOCALE (string)

    Optional. Determines which language the function uses to read the input string. All supported locales are included in the parameter dropdown in the Function Builder.

    Default: en_US

Examples

ATL in Script

Result

Notes

[[monthAsNumber('January')]]

1

The locale is the default en_US. The function reads the input string in English and recognizes it as the first month of the year.

[[monthAsNumber('Jan')]]

1

The locale is the default en_US. The function reads the input string in English and recognizes it as the first month of the year.

[[monthAsNumber('février','fr_FR')]]

2

The locale is set to fr_FR. The function reads the input string in French and recognizes it as the second month of the year.

[[monthAsNumber('marzo','es_ES')]]

3

The locale is set to es_ES. The function reads the input string in Spanish and recognizes it as the third month of the year.

[[monthAsNumber('апреля','ru_RU')]]

4

The locale is set to ru_RU. The function reads the input string in Russian and recognizes it as the fourth month of the year.

[[monthAsNumber('五月','zh_CN')]]

5

The locale is set to zh_CN. The function reads the input string in Chinese and recognizes it as the fifth month of the year.

Important

The convention in English is to write month names with the first letter capitalized (e.g. 'January'). This is not the convention in French ('javier'), Spanish ('enero'), and some other languages.

Remember this because this function is case-sensitive and follows the capitalization convention for the selected language. For example, [[monthAsNumber('may')]] returns an error.