Weekday Function

See AlsoM6LOPP              Example1VHX1Y2>Low

Returns an integer between 1 (Sunday) and 7 (Saturday) that represents the day of the week for a date argument.




The dateexpression part of the syntax is any numeric expression71RISN or string expression1330R89 that can represent a date and/or time from January 1, 100 through December 31, 9999, where January 1, 1900 is 2.  Numbers to the left of the decimal point in dateexpression represent the date; numbers to the right represent the time.  Negative numbers represent dates prior to December 30, 1899.

If dateexpression is Null1DDW7C0, this function returns a Null.

See Also

Date, Date$ Functions3E3X9E

Date, Date$ Statements3E3X9R

Day FunctionLANDAY

Hour FunctionGU67IG

Minute Function5OWKHCJ

Month Function3NARHG

Now FunctionLANNOW

Second FunctionC46EYJ

Year FunctionGUFX5G

Weekday Function Example

The example uses Weekday to determine the day of the week.  To try this example, paste the code into the Declarations section of a form.  Then press F5 and click the form.


Sub Form_Click ()

   Dim DayNum, Msg                       ' Declare variables.

   DayNum = Weekday(Now)                 ' Get current day of the week.

   If DayNum = 1 Or DayNum = 7 Then      ' See if it's a weekend day

      Msg = "Today is a weekend day."

   Else                                  ' or a weekday.

      Msg = "Today is a weekday."

   End If

   MsgBox Msg                            ' Display message.

End Sub