Home > lang > weekday 
 en fr de es it nl pl pt pt_BR mk sq hu cs tr ar fa id vi ko ja ru zh zh_TW eo
Previous  Next  Edit  Rename  Undo  Search  Administration  
Documentation  
Warning! This page is not translated.  See english version 
WeekDay
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.

Example

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")

See also

Date & Time Functions