夜的第七章

WEB开发个人博客。

« Win7下VS2008评估版激活方法感叹下汽车之家李想的话 »

一段跳过周末双休的VBA

'日期,天数
Function GetWorksLimit(ByVal d As Date, ByVal span As Double)

    '获取本地时间
    Dim today, getday
    today = weekday(d, vbMonday)
    
    If today <> 6 And today <> 7 Then
        getday = d + span
    ElseIf today = 6 Then
        getday = d + span + 2
    ElseIf today = 7 Then
        getday = d + span + 1
        
    End If
    
    GetWorksLimit = getday
    
End Function

功能,计算某项工作N天后的时间,跳过周末

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。



[2007 - 2011] © Leadnt.com