Function NextPayDate()
Dim wd, base : base = CDate("6/12/2009")
Dim today : today = Now
If IsPayDate(today) Then
NextPayDate = today
Else
wd = WeekDay(today)
Select Case wd
Case 6:
' if today is a friday
If IsPayDate(DateAdd("d", 14, today)) Then
NextPayDate = DateAdd("d", 14, today)
End If
Case 7:
' if today is a saturday
If IsPayDate(DateAdd("d", 6, today)) Then
NextPayDate = DateAdd("d", 6, today)
Else
NextPayDate = DateAdd("d", 13, today)
End If
Case Else:
If IsPayDate(DateAdd("d", 6-wd, today)) Then
NextPayDate = DateAdd("d", 6-wd, today)
Else
NextPayDate = DateAdd("d", 13-wd, today)
End If
End Select
End If
End Function
Sunday, July 5, 2009
VBScript / ASP Determine Next Pay Date
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment