comparing dates

D

Dan Nash

Hi peeps

I have an expiry date stored as a text field in the
following way "2003-08-23" (this gets round the US/UK
date prob)

The problem is I want to be able to show a Renew option
on the page FROM 30 days prior to that date. And then of
course if they don't renew, it unsubscribes them.

Question, how can I compare this date to see if todays
date is 30 days or closer to the expiry date?

Cheers


Dan
 
D

dlbjr

Function CheckDaysToExpire(strDate,intThreshold)

CheckDaysToExpire = False

If Len(strDate) <> 10 Tnen

If Not IsNumeric(intThreshold) Then

intThreshold = 0

End If

dtmDate = DateSerial(Left(strDate,4),Mid(strData,6,2),Right(strData,2)

If DateDiff("d",dtmDate,Date) < CInt(intThreshold) Then

CheckDaysToExpire = True

End If

End If

End Function


-dlbjr

invariable unerring alien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top