Public Function TimeDifference(ByVal fd As String, ByVal ld As String) As String
fd=first date
ld=last date
simply pass fd and ld in datediff function given below
Public Function TimeDifference(ByVal fd As String, ByVal ld As String) As String
Dim lastcomctonday As String = DateDiff("d", fd, ld)
Dim lastcomcton As String = DateDiff("n", fd, ld)
'Dim lastcomsec As String = DateDiff("s", fd, ld)
If Val(lastcomcton) < 60 Then
timedif = "After Complaint: " & "0 Hours " & lastcomcton & " Minutes Later" '"Same Day " &
ElseIf Val(lastcomcton) / 60 < 24 Then
timedif = "After Complaint: " & CStr(Math.Round(Val(lastcomcton) / 60, 0)) & " Hour(s) Later" '"Same Day " &
Else
timedif = "After Complaint: " & lastcomctonday & " Days Later"
End If
Return timedif
End Function
fd=first date
ld=last date
simply pass fd and ld in datediff function given below
Public Function TimeDifference(ByVal fd As String, ByVal ld As String) As String
Dim lastcomctonday As String = DateDiff("d", fd, ld)
Dim lastcomcton As String = DateDiff("n", fd, ld)
'Dim lastcomsec As String = DateDiff("s", fd, ld)
If Val(lastcomcton) < 60 Then
timedif = "After Complaint: " & "0 Hours " & lastcomcton & " Minutes Later" '"Same Day " &
ElseIf Val(lastcomcton) / 60 < 24 Then
timedif = "After Complaint: " & CStr(Math.Round(Val(lastcomcton) / 60, 0)) & " Hour(s) Later" '"Same Day " &
Else
timedif = "After Complaint: " & lastcomctonday & " Days Later"
End If
Return timedif
End Function
No comments:
Post a Comment