havey
06-10-2005, 08:46 PM
i have two dates, one from a db the other from Date(), like so:
cx = rs("maintain_fee_start")
ee = date()
I need to do some funky date comparision and not sure how to go about it, I need to say something like
If its currently 2 months prior to 1 year from cx
....
ElseIf (its currently (2 month prior to 1 year from cx) + (minus 1 day)) then
...
ElseIf (its currently (2 month prior to 1 year from cx) + (minus 2 days)) then
...
ElseIf (its currently (1 month prior to 1 year from cx) + (minus 1 days)) then
.....
ElseIf (its currently (1 month prior to 1 year from cx) + (minus 2 days)) then
...
ElseIf (its currently 10 days prior to 1 year from cx) then
...
ElseIf (its currently 9 days prior to 1 year from cx) then
...
End If
miranda
06-10-2005, 10:03 PM
http://www.w3schools.com/vbscript/vbscript_ref_functions.asp
havey
06-10-2005, 11:36 PM
i think i got it, but was wondering if there was a more efficient way to do this:
If (DatePart("y",ee)-DatePart("y",cx)) < 0 Then 'subscription expired
...
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 0 Then 'on the day (its been a whole year)
....
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 1 Then '1 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 2 Then '2 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 3 Then '3 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 4 Then '4 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 5 Then '5 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 6 Then '6 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 7 Then '7 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 8 Then '8 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 9 Then '9 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 10 Then '10 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 24 Then '1 months less 6 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 25 Then '1 months less 5 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 26 Then '1 months less 4 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 27 Then '1 months less 3 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 28 Then '1 months less 2 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 29 Then '1 months less 1 day from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 30 Then '1 months from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 54 Then '2 months less 6 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 55 Then '2 months less 5 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 56 Then '2 months less 4 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 57 Then '2 months less 3 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 58 Then '2 months less 2 days from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 59 Then '2 months less 1 day from the day
...........
ElseIf (DatePart("y",ee)-DatePart("y",cx)) = 60 Then '2 months from the day
.....
End If
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.