2014年1月14日 星期二

[AP] 計算該日的歸屬週別

'//計算該日的歸屬週別

Function WEEKNUM(NDate As Variant) As String
On Error Goto errorhandler
Dim SSD As New NotesDateTime(NDate)
Dim SBA As New NotesDateTime(Year(SSD.LsLocalTime)&"/01/01")
Dim nDay As Integer, nWeekNo As Integer
'
nDay = Cint(Cdbl(SSD.LSLocalTime) - Cdbl(SBA.LSLocalTime))
nWeekNo = Cint(nDay / 7) + 1
WEEKNUM = Cstr(nWeekNo)
TheEnd:
Exit Function
ErrorHandler:
Print "WEEKNUM function error line = " + Cstr(Erl) + ", error = " + Error$
Resume TheEnd
End Function

沒有留言:

張貼留言