The weekday() function takes a dateTimeValue as an argument, and returns a number representing the day of the week on which the specified dateTimeValue falls.

1 represents Sunday, 2 represents Monday, and so on, with 7 being the final number representing Saturday.

Return Type

  • Number


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


<variable> = weekday(<dateTimeValue>);


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


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

The date-time value based on which a number will be returned.

The time value is not taken into account while using this function.

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.



currentDate = '15-Mar-2019';
dayNumber = currentDate.weekday();      // returns 6 (meaning Friday)

Share this post : FacebookTwitter

Still can't find what you're looking for?

Write to us: support@zohodeluge.com