Between 2 Dates?? Help...

# Thread: Between 2 Dates?? Help...

1. Senior Member
Join Date
Dec 1969
Posts
301

## Between 2 Dates?? Help...

I am making a calendar where my partners and I can schedule out our airplanes. I have it all down except reserving across multiple (3 or more... I figured out 2) days...<BR><BR>vars:<BR>dateCounter = 1 &#039;loop as it goes through each day<BR>rsdate = RSEVENT("dteStart")<BR>rsdate2 = RSEVENT("dteFinish")<BR><BR>I want to say something like:<BR>If dateCounter is Between rsdate and rsdate2 then<BR>response.write ("* * *")<BR><BR>If there was a between function that would be nifty, huh? (I&#039;ve checked MSDN, unless I missed it... it sounds like something ive used before though??)<BR><BR>If you need a visual:<BR>http://demo.hostiowa.net/events<BR><BR>Thanks!

2. Senior Member
Join Date
Dec 1969
Posts
16,931

## RE: Between 2 Dates?? Help...

I can&#039;t see how this is advanced, if I&#039;m honest.<BR><BR>One question. If "dteStart" and "dteFinish" are dates in the database, and "dateCounter" is an integer, what exactly are you meant to be comparing?<BR><BR>You&#039;re not after whether the counter is between rsdate and rsdate2. Because the counter&#039;s a number and those variables are dates. You may be after whether counter is between the Day() parts (big hint there) of the dates. But you haven&#039;t said.<BR><BR>Craig.

3. Senior Member
Join Date
Dec 1969
Posts
301

## RE: Between 2 Dates?? Help...

Youre right. I have the Day() used above in the code.<BR>However, I cannot figure out how to say "whether counter is between the two dates". There is not a function, unless I&#039;m not seeing it...

4. Senior Member
Join Date
Dec 1969
Posts
16,931

## RE: Between 2 Dates?? Help...

No, there&#039;s not a function, but come on...<BR><BR>[code language="VBScript"]<BR>Function Between(iCount, iMin, iMax)<BR> Between = ((iCount &#062; iMin) AND (iCount &#060; iMax))<BR>End Function<BR>Function BetweenInclusive(iCount, iMin, iMax)<BR> Between = ((iCount &#062;= iMin) AND (iCount &#060;= iMax))<BR>End Function<BR>[/code]<BR><BR>It&#039;s really not that hard to write one, is it? Advanced?<BR><BR>Craig.

5. Senior Member
Join Date
Dec 1969
Posts
301

## :-)

Wow. I made that way harder than it was... late night :-)<BR><BR>Thanks, Craig!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•