# weekday - script and chart function

This function returns a dual value with:

* A day name as defined in the environment variable DayNames.
* An integer between 0-6 corresponding to the nominal day of the week (0-6).

Syntax:

weekday(date [,first\_week\_day=0])

**Return data type:** dual

Arguments:

Weekday arguments

| Argument | Description |
| --- | --- |
| date | The date to evaluate. |
| first\_week\_day | If you don't specify first\_week\_day, the value of variable FirstWeekDay will be used as the first day of the week.<br><br>If you want to use another day as the first day of the week, set first\_week\_day to:<br><br><ul> <li>0 for Monday</li> <li>1 for Tuesday</li> <li>2 for Wednesday</li> <li>3 for Thursday</li> <li>4 for Friday</li> <li>5 for Saturday</li> <li>6 for Sunday</li> </ul><br><br>The integer returned by the function will now use the first day of the week that you set with first\_week\_day as base (0). |

Example 1:

`weekday( 
 '1971-10-12' )`

returns 'Tue' and 1

Example 2:

`weekday( 
 '1971-10-12' , 6)`

returns 'Tue' and 2.

In this example we use Sunday (6) as the first day of the week.

Example 3:

`weekday( 
 '1971-10-12')`

returns 'Tue' and 2.