www.webdeveloper.com
Results 1 to 2 of 2

Thread: how to create news archive

  1. #1
    Join Date
    Jul 2005
    Posts
    13

    how to create news archive

    in this news archive i want create a dropdown box for one month date from current date.suppose today date is 7/26/05.now i want to populate this box with values like 6/25/05-------------7/25/05.means one month back of current date.when user select any of date of this box then corresponding category of news will display.

    this is only over view.i want basic idea how to perform such task.......

    thanx

  2. #2
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    Ok. Should be fairly straight-forward.

    First of all, you need to get the date exactly one month ago.
    Code:
    Dim dteLastMonth: dteLastMonth = DateAdd("m", -1, Date())
    Then get the difference in days from then to now, loop through that number of times, adding one day at a time.
    Code:
    Dim intDiff, i, dteIncrement
    intDiff = DateDiff("d", dteLastMonth, Date())
    
    Response.Write "<select name=""dteChooser"">"
    For i = 0 To intDiff
       dteIncrement = DateAdd("d", i, dteLastMonth)
       Response.Write "<option value=""" & dteIncrement & """>" & dteIncrement & "</option>" & VbCrLf
    Next
    Response.Write "</select>"
    Make sense?

    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