|
-
Feb 2nd, 2004, 09:06 PM
#1
Thread Starter
Frenzied Member
[VB] Comparedates
'Comparedates "3/24/01", "3/22/01"
'will return true because the first date
'is after the 2nd
'
Function Comparedates(a As String, B As String) As Boolean
Comparedates = False
Dim Now_Day As Integer
Dim Now_Month As Integer
Dim Now_Year As Integer
Dim Then_Day As Integer
Dim Then_Month As Integer
Dim Then_Year As Integer
Dim i(1) As Integer
i(0) = 1
i(0) = InStr(i(0), a, "/")
Now_Month = Left(a, i(0) - 1)
i(1) = InStr(i(0) + 1, a, "/")
Now_Day = Mid(a, i(0) + 1, i(1) - i(0) - 1)
Now_Year = Right(a, Len(a) - i(1))
i(0) = 1
i(0) = InStr(i(0), B, "/")
Then_Month = Left(B, i(0) - 1)
i(1) = InStr(i(0) + 1, B, "/")
Then_Day = Mid(B, i(0) + 1, i(1) - i(0) - 1)
Then_Year = Right(B, Len(B) - i(1))
If Now_Year > Then_Year Or Now_Month > Then_Month Then Comparedates = True
If Now_Month = Then_Month And Now_Day > Then_Day Then Comparedates = True
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|