weekdayIndex

To return a given weekday name as a number

With this function, you can determine the corresponding weekday as a number from a weekday name. The weekday is a number with Monday = 0, Tuesday = 1, ... Sunday = 6.

The function can be quite handy if the weekday is only available as a text, for example, “Monday”, but you need it as a number for further processing.

Syntax

weekdayIndex(string)

Return

number

Examples

weekdayIndex(myWeekdayName) To return the weekday of a given weekday name as a number with Monday = 0, Tuesday = 1, … Sunday = 6.

weekdayIndex("Monday")

Result: 0

See also

monthIndex, which returns a given month as a number out of a string.

Last updated