I have looked into ARRAYS but I have to say i didnt find any tutorials that pointed me in the right direction.
Main Topics
Browse All TopicsI have developed a ASP Calendar that shows my business customers what date(s) my store is closed either due to (A)Bank Holiday - ireland or (B)Special Occasion.
Currently the calendar loops through the database and if there is a START DATE equal to the day being printed on the webpage it CHANGES the cell colour to the specific event.
** PROBLEM **
the database has the following fields
CalID - unique id
CalDateFrom - start date
CalDateTo - end date
CalType - bank holiday / special occasion
Not all holidays are only 1 day long so a sample record mite be
CalID - 12
CalDateFrom - 20/08/2004
CalDateTo - 24/08/2004
CalType - special occasion
** QUESTION **
in an ideal world the script would look at the START and END dates and if they werent equal it would colour the cells until they are both meet.
As I said above my script only picks up the START date, so if a holiday is longer than a day it dosent pick it up so the user sees the holiday as a single day.
I have tried and tried different ways to get the "ideal world" solution but I keep getting the same result nothing!
Any help would be great hense the points im giving for this ;o)
link to the files: http://s11.yousendit.com/d
Mark
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Here's a little bit of code that'll help you:
<%
set rs = server.createObject("ADODB
rs.Open "<<your query here>>",conn,3,3
Dim myHolidayArray(3,rs.Record
for i=1 to rs.RecordCount
myHolidayArray(0,i-1) = FormatDateTime(rs("CalDate
myHolidayArray(1,i-1) = FormatDateTime(rs("CalDate
myHolidayArray(2,i-1) = rs("CalType")
next
rs.Close
set rs = Nothing
%>
That will populate your array with what you want:
Then, something like this
function checkHoliday(calArray,give
checkHoliday = ""
for i=1 to UBound(calArray, 2)
if givenDate >= CDate(calArray(0,i)) and givenDate <= CDate(calArray(1,i)) then
checkHoliday = calArray(2,i)
end if
next
end function
That should do it, with some minor tweaking to make up for some of my unforseen errors :P
Dan
OOPS...missing a rs.moveNext....
<%
set rs = server.createObject("ADODB
rs.Open "<<your query here>>",conn,3,3
Dim myHolidayArray(3,rs.Record
for i=1 to rs.RecordCount
myHolidayArray(0,i-1) = FormatDateTime(rs("CalDate
myHolidayArray(1,i-1) = FormatDateTime(rs("CalDate
myHolidayArray(2,i-1) = rs("CalType")
rs.moveNext
next
rs.Close
set rs = Nothing
%>
It depends on how you retrieve the records.
In your case, you are doin a "Select * from table" and loop through the record.
If it is a month view, you can do this ..
for i = 1 to 30
Select * from table where Startdate => 'i' and EndDate <= 'i'
....and then highlight the field.
While not rs.eof
.....response.write rs("xxx")
rs.movenext
wend
next
This will help if you have multiple events happening on the same day and you still can capture them.
Business Accounts
Answer for Membership
by: dwaldnerPosted on 2004-08-20 at 07:42:05ID: 11851734
1. Create a function that takes in two parameters, an array (of the start date, end date, and CalType) and the date in question. This function will traverse the array, and return:
"" - if the date does NOT fall into a range of holidays
CalType - if the date does fall within a holiday range (or many holiday ranges)
2. When you're trying to determine how to display the day, call that function...
Just my 0.02,
Dan