Displaying Items Within a Specific Date Range

Results 1 to 2 of 2

Thread: Displaying Items Within a Specific Date Range

  1. #1
    Join Date
    Dec 1969

    Default Displaying Items Within a Specific Date Range

    I want to create a "What&#039s New" feature on my web site where I display any documents or links added to the web site within the past 14 days. I am using a database (MSAccess) to store the documents and links. In the tables I am recording the date the item was added to the site/database. Anything added to the site/database within the past 14 days should be displayed in a list - anything older than that should not be displayed.<BR><BR>I want to do this is ASP/VBScript. What&#039s the best way to accomplish this??<BR><BR>Thanks in advance for any and all help...<BR>steve

  2. #2
    Join Date
    Dec 1969

    Default RE: Displaying Items Within a Specific Date Range

    This is how you would do it assuming you knew quite a bit about how to connect to a database. If you don&#039t, read one of the many good tutorials on this site. What you need to do is really all in the SQL statement.<BR><BR><BR>&#060;html&#062;<BR>&#060;bo dy bgcolor="#FFFFFF"&#062;<BR>&#060;%<BR>mydate=date< BR>&#039I am not sure of the syntax of the following.<BR>&#039You need to subtract 14 days. To find a language ref.<BR>&#039go to http://msdn.microsoft.com/scripting/<BR><BR>myolddate=date-14<BR>set rs=Server.CreateObject("adodb.Recordset")<BR><BR> connectme="DSN=yourdsn"<BR><BR>strSQL= "SELECT * FROM yourtable WHERE yourdatecolumn&#060;&#039"&Mydate&"&#039 and yourdatecolumn&#062;&#039"&Myolddate&"&#039"<BR>%& #062;<BR>Display results however<BR>&#060;%<BR>rs.MoveNext<BR>Loop<BR> RS.Close<BR> %&#062;<BR><BR>

Posting Permissions

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