📄 moddateset.bas
字号:
Attribute VB_Name = "ModDateSet"
Option Explicit
Public dateSelect As Variant '选择的日期
Public iSet As Integer '选择的日
Public iYear As Integer '选择的年
Public iMonth As Integer '选择的月
Public sWeek As String
'选择的月的天数
Public Function CountDay(Year As Integer, Month As Integer) As Integer
Dim count As Integer
On Error GoTo Err_Trap
count = -1
If Month = 1 Or Month = 3 Or Month = 5 Or Month = 7 Or Month = 8 Or Month = 10 Or Month = 12 Then
count = 31
ElseIf Month = 4 Or Month = 6 Or Month = 6 Or Month = 9 Or Month = 11 Then
count = 30
Else
If Year Mod 4 = 0 Then
count = 29
Else
count = 28
End If
If Year Mod 100 = 0 And Year Mod 400 <> 0 Then
count = 28
End If
End If
CountDay = count
Exit Function
Err_Trap:
End Function
'选择的月的一号是星期几
Public Function SetWeekStart(NowDate As Date) As Integer
Dim iWeekDay As Integer
Dim sStartDay As String
On Error GoTo Err_Trap
iYear = Left(NowDate, 4)
iMonth = Mid(NowDate, 6, (InStr(6, NowDate, "-") - InStr(1, NowDate, "-") - 1))
sStartDay = iYear & "-" & iMonth & "-1"
SetWeekStart = Weekday(sStartDay)
Exit Function
Err_Trap:
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -