www.webdeveloper.com
Results 1 to 4 of 4

Thread: Calendar project

  1. #1
    Join Date
    Aug 2004
    Posts
    82

    Calendar project

    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.

    ex.

    10/20/2004 - 10/30/2004

    Under this each date is listed separately with any events that fall on those dates.

    ex.

    10/20/2004
    something

    10/21/2004
    something else

    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,

    Code:
          <%response.write (request("date")) '& " " & "-" & " " & date + 7%>
          <br>
          </strong></p>
      <p>
      <%
    Dim curDate
    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")
    dbConn.Open strConnect
    
    
    %> 
    <%
    
    '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")
       Response.Write "<P><HR><P>"
     objRS.MoveNext
    Loop 
    %><BR>
    
    
    <%    '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 "<P><HR><P>"
     objaRS.MoveNext
    Loop 
      %><BR>
      
      
      
      <%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>

  2. #2
    Join Date
    Oct 2003
    Posts
    235
    dude your reinventing the wheel. check out:

    DynaCal

    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.

  3. #3
    Join Date
    Jun 2004
    Posts
    390
    ASP.NET has an excellent calendar object too, if you wanted to take the leap forward...

  4. #4
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    I hope I understand correctly.

    Have you tryed the DateAdd() function?
    Code:
    DateAdd("d", 7, yourDate)
    That should return a date that is 7 days past the date passed to it.

    Regards.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles