WeekDay
Syntax
Result = WeekDay ( Date AS Date ) AS Integer
Returns the week day of a Date value.
Returns an integer between 0 (Sunday) and 6 (Saturday) that represents the day of the week for a date argument.
See Predefined Constants for a list of constants associated with week days.
Examples
PRINT Now; " -> "; WeekDay(Now)
05/16/2002 22:31:30 -> 4
IF WeekDay("6/8/2008") = 0 THEN
PRINT "It is a Sunday"
ELSE
PRINT "It is not a Sunday"
ENDIF
It is a Sunday
DIM DayNames AS String[]
DIM D AS Date
DayNames = Split("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")