Weekday Function

Weekday(, [`date`

])`firstdayofweek`

`date`

Use: Required

Data Type: Variant

Any valid date expression.

`firstdayofweek`

Use: Optional

Data Type: Integer

Integer specifying the first day of the week.

An Integer.

Determines the day of the week of a given date.

The following intrinsic VBScript constants determine the value returned by the

*Weekday*function:

Constant | Return value | Day represented |

| 1 | Sunday |

| 2 | Monday |

| 3 | Tuesday |

| 4 | Wednesday |

| 5 | Thursday |

| 6 | Friday |

| 7 | Saturday |

If

is`date`

`Null`

, the*Weekday*function also returns`Null`

.The following table describes the settings for the

argument:`firstdayofweek`

Constant | Value | Description |

vbUseSystem | 0 | Use the NLS API setting |

vbSunday | 1 | Sunday (default) |

vbMonday | 2 | Monday |

vbTuesday | 3 | Tuesday |

vbWednesday | 4 | Wednesday |

vbThursday | 5 | Thursday |

vbFriday | 6 | Friday |

vbSaturday | 7 | Saturday |

If you specify a

argument, the function returns the day of the week relative to`firstdayofweek`

. For instance, if you set the value of`firstdayofweek`

to`firstdayofweek`

`vbMonday`

(2), indicating that Monday is the first day of the week, and attempt to determine the day of the week on which October 1, 1996, falls, the function returns a 2. That’s because October 1, 1996, is a Tuesday, the second day of a week whose first day is Monday.Because the function’s return value is relative to

, using the day of the week constants to interpret the function’s return value ...`firstdayofweek`

Start Free Trial

No credit card required