1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Get Last week / this week last month values in combo

Discussion in 'C#' started by tim33, Jul 1, 2007.

  1. #1
    I am trying to create search by week.
    I have a date field contains dates like 1/5/2007 & 5/7/2007
    I want to build searchpage and create combo for the date field search and in combo i just want to put this week/last week/ last month etc. rather than having user put the date & then pass the value of that start date in the options at the back through code.

    How do i bring in the last weeks start date or last 3rd weeks start date in combo so it should search as per the start and end date. And user only get to see the Last week/ this week / last month

    Leave today's date and like today is 07/01/2007
    So last week should become - 24/06/2007
    So if some one picks Last two weeks option from combo then want to search the values start date should be 17/ 06/2007
    and last 4 weeks 3/06/2007
    and last 6 weeks 20/05/2007

    and i want to move the values till last 20 weeks. So will run the loop for week till last 20 weeks.
    So in Combo it will display 20 date values, starting from today and then -7 days, then -14 days, then 21 days, then -28 days, then -35 days. Or -1week, -2weeks,-3week,-4week till -20 week.

    Either way, which ever is convenient for you, And if you want to include todays date too then that's ok too, basic concept is to get 7 days prior date somehow i combo.
    tim33, Jul 1, 2007 IP
  2. dankenpo

    dankenpo Guest

    Likes Received:
    Best Answers:
    Trophy Points:
    I don't understand what you mean. . . please clarify.
    dankenpo, Jul 8, 2007 IP
  3. N_F_S

    N_F_S Active Member

    Likes Received:
    Best Answers:
    Trophy Points:
    I think it's more related to SQL than ASP. Check SQL's DATE_SUB statement.
    N_F_S, Jul 9, 2007 IP