Returns a number representing the day of the week (a number from 1 to 7) for a given date value.
Syntax Weekday ( date, [firstdayofweek] ) Key date Any valid date expression.
firstdayofweek A constant that specifies the first day of the week default = 1 or vbSunday. if set to 0 or vbUseSystem it will use the NLS API setting - see List of Locales
The weekday() function can be used in VBA or in an SQL query. The vb constants can only be used in VBA.
To create day numbers compatible with ISO 8601 standard dates, set thefirstdayofweek to Monday(2 or vbMonday)
Dim intDay as Integer
intday = weekday("30/04/2012",2)
'will return 1 (Monday)
A function to determine if it is the weekend:
Function IsWeekend(dtm as Date)
'Returns True if dtm is a Saturday or Sunday
If Weekday (dtm,vbMonday) = 6 or Weekday (dtm,vbMonday) = 7 Then
IsWeekend = True
IsWeekend = False
“A committee is a thing which takes a week to do what one good man can do in an hour” ~ Elbert Hubbard
Date - Return the current date.
DatePart - Return part of a given date.
MonthName - Return a string representing the month.
Format - Format a Number/Date/Time.
WeekdayName - Return the day of the week.
Standard date and time notation - YYYY-MM-DD