Specifiying Date Ranges

1. Kim
Senior Member
Join Date
Dec 1969
Posts
412

## Specifiying Date Ranges

Is there a way to set a variable equal to a range of dates? For example, if a child needs a shot at 6 months, then needs the next shot when they are between 15-18 months old, how do I specify the b/t 15-18 months in a variable? In short, here&#039;s an example (not all of my code - "i" is a table cell)<BR><BR>&#060;%if i = 1 then<BR> strDose = DateAdd("m", 6, rs("BirthDay")<BR>elseif i = 2 then<BR>****here&#039;s what I want to say (in pseudo-code) *****<BR> strDose = DateAdd("m", 15, rs("BirthDay") to DateAdd("m", 18, rs("BirthDay")%&#062;<BR><BR>Thanks in advance!<BR><BR>

2. Senior Member
Join Date
Dec 1969
Posts
614

## Between

Investigate the SQL Between function....<BR><BR>http://w3.one.net/~jhoffman/sqltut.htm

3. Kim
Senior Member
Join Date
Dec 1969
Posts
412

## I should have clarified...

Thanks for your response, but I have to do this in ASP, not SQL. Any way to specify date ranges in ASP?

4. kpw Guest

## RE: Specifiying Date Ranges

strDose = CStr(DateAdd("m", 15, rs("BirthDay")) & " to " & CStr(DateAdd("m", 18, rs("BirthDay"))<BR><BR>Is this what you want?

5. kpw Guest

## Oops, should be....

strDose = CStr(DateAdd("m", 15, rs("BirthDay"))) & " to " & CStr(DateAdd("m", 18, rs("BirthDay")))<BR><BR>HTH

6. Senior Member
Join Date
Dec 1969
Posts
614

## Sorry, try this...

dtmBD="21-jan-2000"<BR>strDose = "GIVE SHOT BETWEEN " & DateAdd("m", 15, dtmBD) & " to " & DateAdd("m", 18, dtmBD)<BR>alert strDose<BR>

7. Kim
Senior Member
Join Date
Dec 1969
Posts
412

## Thanks, I figured it out!

Thanks for the help, but I ended up putting the dates in an array

#### Posting Permissions

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