I have a fully functioning asp calendar on my Intranet (found it on this site). The purpose is to allow a user to click on a date and view the events for that day and 6 days after. I got that 90% working. Here is where I'm having trouble. Under the calendar I'm using response.write to display the date selected and the sixth day after.
10/20/2004 - 10/30/2004
Under this each date is listed separately with any events that fall on those dates.
The selected date is passed through the URL using date as a variable. I started using the date function but it only wants to display the current date and what ever I add on to it.
response.write date + 7
The problem I am having is when I select a different day it only displays the current date + 7. The events are listed correctly but the dates above them still display the current + 7. I tried assigning the code to use the variable date (passed at the url) but it is looking at it as a string not a date. When I try to add 7 to it I get an error. Any idea how I can use the varaible date (passed at the url) to make this work? Thanks,
<%response.write (request("date")) '& " " & "-" & " " & date + 7%>
curDate = request("date")
strConnect = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source='c:\database\qa.mdb' ;Persist Security Info=False"
set dbConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
Set objaRS = Server.CreateObject("ADODB.Recordset")
'objRS.Close 'Close recordset
'Set objRS = Nothing 'Set recordset to nothing
'dbConn.Close 'Close Database connection
'Set dbconn = Nothing 'Set db connection to nothing
<% 'Current Date
response.write date & "<BR>"
strSQL = "SELECT * FROM evtCalendar WHERE evtBDate='" & curDate & "'"
objRS.Open strSql, dbConn
Do Until objRS.EOF = True 'Displays results
Response.Write "<BR>Event Name: " & objRS("evtName")
Response.Write "<BR>Event Description: " & objRS("evtDescription")
<% 'Current date plus one day
curaDate = date + 1
response.write date + 1 & "<BR>"
straSQL = "SELECT * FROM evtCalendar WHERE evtBDate='" & curaDate & "'"
objaRS.Open straSQL, dbConn
Do Until objaRS.EOF = True 'Displays results
Response.Write "<BR>Event Name: " & objaRS("evtName")
Response.Write "<BR>Event Description: " & objaRS("evtDescription")
<%response.write date + 2%><BR>
<%response.write date + 3%><BR>
<%response.write date + 4%><BR>
<%response.write date + 5%><BR>
<%response.write date + 6%><BR>
<%response.write date + 7%><BR>
dude your reinventing the wheel. check out:
I asure you I have no intrest (vested or otherwise) in this company, but I am the tech director at a school and you get way more than your money's worth.
I know you said your just about done with yours but this is worth looking into. Sorry for not answering your questions directly but this might save you long term work.
ASP.NET has an excellent calendar object too, if you wanted to take the leap forward...
I hope I understand correctly.
Have you tryed the DateAdd() function?
That should return a date that is 7 days past the date passed to it.
DateAdd("d", 7, yourDate)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)