|
6#
楼主 |
发表于 2010-10-11 06:51:52
|
只看该作者
我觉得楼主的猜想还是有点距离
aslxt 发表于 2010-10-10 22:42
有道理,应该是第三个示例:
Function Calendar3(Ddate As Date) As String
'功能:每季度按445周的的工厂日历
Dim Mydate As Date
Dim str As String
Dim i As Long, j As Long, m
Mydate = DateSerial(Ddate - 1, 10, 1)
str = str & 1 & ";" & Mydate & ";"
If Weekday(Mydate, vbMonday) <> 6 Then
Mydate = DateAdd("d", 21, Mydate)
For j = 1 To 7
If Weekday(Mydate, vbMonday) = 5 Then
Exit For
End If
Mydate = DateAdd("d", 1, Mydate)
Next
Else
Mydate = DateAdd("d", 20, Mydate)
End If
str = str & Mydate & ";"
m = 0
For i = 1 To 4
For j = 1 To 3
m = m + 1
If m = 12 Then Exit For
If m <> 1 Then
str = str & m & ";" & DateAdd("d", 1, Mydate) & ";"
If j <> 3 Then
Mydate = DateAdd("d", 28, Mydate)
Else
Mydate = DateAdd("d", 35, Mydate)
End If
str = str & Mydate & ";"
End If
Next
If m = 12 Then Exit For
Next
str = str & m + 1 & ";" & DateAdd("d", 1, Mydate) & ";" & DateSerial(Ddate, 9, 30)
Calendar3 = str
End Function
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|