lang • weekday


Result = WeekDay ( Date )

Compute the week day of a date.

  • Date is the date to process.

Returns an integer between 0 (Sunday) and 6 (Saturday) that represents the day of the week.

See Predefined Constants for a list of constants associated with week days.


Print Now; " -> "; WeekDay(Now)
05/16/2002 22:31:30 -> 4
If WeekDay("6/8/2008") = 0 Then
  Print "It is a Sunday"
  Print "It is not a Sunday"
It is a Sunday
Dim DayNames As String[]
Dim D As Date

DayNames = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]

D = "6/8/2008"
Print "It was a "; DayNames[WeekDay(D)]; " on "; Format$(D, "d mmm,yyyy")
It was a Sunday on 8 Jun,2008
' This example gives the date for the next coming sunday
Dim D As Date
D = DateAdd(Now, gb.Day, 7 - WeekDay(Now))
Print "The next Sunday falls on "; Format$(D, "d mmm,yyyy")

See also