weekday()
Table of Contents
Overview
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
Syntax
<variable> = <dateTimeValue>.weekday();
(OR)
<variable> = weekday(<dateTimeValue>);
(OR)
<variable> = <dateTimeValue>.getDayOfWeek();
(OR)
<variable> = getDayOfWeek(<dateTimeValue>);
Parameter | Description | Data type |
---|---|---|
<variable> | Variable which will contain the returned number. | NUMBER |
<dateTimeValue> | 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 function returns a null value if:
Please refer this help document to learn about the supported date-time formats. | DATE-TIME |
Examples
currentDate = '15-Mar-2019';
dayNumber = currentDate.weekday(); // returns 6 (meaning Friday)
dayNumber = currentDate.weekday(); // returns 6 (meaning Friday)