WeekDay()
函式返回一個從1
到7
的整數,表示指定日期的星期幾。
語法
Weekday(date[,firstdayofweek])
引數
新增一個模組,並新增以下範例程式碼 -
Private Sub Constant_demo_Click()
msgbox("Line 1: " & Weekday("2013-05-16",1))
msgbox("Line 2: " & Weekday("2013-05-16",2))
msgbox("Line 3: " & Weekday("2013-05-16",2))
msgbox("Line 4: " & Weekday("2010-02-16"))
msgbox("Line 5: " & Weekday("2010-02-17"))
msgbox("Line 6: " & Weekday("2010-02-18"))
End Sub
執行上面範例程式碼,得到以下結果 -
Line 1: 5
Line 2: 4
Line 3: 4
Line 4: 3
Line 5: 4
Line 6: 5