Skip to main content

weekdayAsNumber

Returns the number for the input weekday name — e.g. 2 for Tuesday.

You can pick which language the function uses by specifying a locale in the second parameter. Most locales start the week on Monday, but be aware that some (including the default locale) start on Sunday instead.

The default language is US English.

To perform the reverse operation, use the numberAsWeekday function.

Parameters

  • WEEKDAY NAME (string)

    The input weekday name. You can give the name in full (e.g. 'Monday) or in abbreviated form (e.g. 'Mon').

  • 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

[[weekdayAsNumber('Sunday')]]

1

The locale is the default en_US. The function reads the input string in English (United States) and recognizes it as the first day of the week. This locale starts the week on Sunday.

[[weekdayAsNumber('Sunday','en_GB')]]

7

The locale is set to en_GB. The function reads the input string in English (United Kingdom) and recognizes it as the seventh day of the week. This locale starts the week on Monday.

[[weekdayAsNumber('Sun','en_GB')]]

7

The locale is set to en_GB. The function reads the input string in English (United Kingdom) and recognizes it as the seventh day of the week. The weekday name is entered in an abbreviated form.

[[weekdayAsNumber('mardi','fr_FR')]]

2

The locale is set to fr_FR. The function reads the input string in French (France) and recognizes it as the second day of the week. This locale starts the week on Monday.

[[weekdayAsNumber('miércoles','es_ES')]]

3

The locale is set to es_ES. The function reads the input string in Spanish (Spain) and recognizes it as the third day of the week. This locale starts the week on Monday.

[[weekdayAsNumber('четверг','ru_RU')]]

4

The locale is set to ru_RU. The function reads the input string in Russian (Russia) and recognizes it as the fourth day of the week. This locale starts the week on Monday.

[[weekdayAsNumber('星期四','zh_CN')]]

5

The locale is set to zh_CN. The function reads the input string in Chinese (China) and recognizes it as the fifth day of the week. This locale starts the week on Sunday. 星期四 is the Chinese symbol for Thursday.

Important

The convention in English is to write weekday names with the first letter capitalized (e.g. 'Monday'). This is not the convention in French ('lundi'), Spanish ('lunes'), and some other languages.

Remember this because the function is case-sensitive and follows the selected language's convention. For example, [[weekdayAsNumber('monday')]] returns an error.