Dynamic Dates

Results 1 to 5 of 5

Thread: Dynamic Dates

  1. #1
    Join Date
    Dec 1969

    Default Dynamic Dates

    I have a web page where a user selects a date from a popup calendar (into the form field called TransDate) and then submits the date. The result page should display a report that has information from the entire week that the date falls within. The report week should be 7 days beginning with Monday and ending on Sunday. So if the users enters todays date, 1/18/2001, I want the records retrieved to be Monday 1/15/2001 to Sunday 1/21/2001. How can I accomplish this? Thanks so much for any assistance.

  2. #2
    Kasper Guest

    Default Re: Dynamic Dates

    First use the DatePart function to retrieve the day of the week (http://www.webaptitude.com/mgt818/vbsdocs/vbs95.htm), then subtract the date until you reach monday. E.g. DatePart gives you Wednesday, use the DateAdd function to subtract 2 days.<BR>For the last day of the week, add seven to the monday.<BR>You&#039;ll figure it out :)

  3. #3
    KasperĀ² Guest

    Default Err

    Remove the ) from the url.

  4. #4
    Join Date
    Dec 1969

    Default Here you go...

    &#060;%<BR>DateEntered = "2/29/2000"<BR><BR><BR>Response.Write "Weekday Number: " & Weekday(DateEntered, 2) & "<BR>"<BR><BR>Response.Write "Date Entered: " & DateEntered & "<BR>"<BR><BR>Response.write "First Day: " & CDate(DateEntered) - Weekday(DateEntered, 2) + 1 & "<BR>"<BR><BR>Response.Write "Last Day: " & CDate(DateEntered) - Weekday(DateEntered, 2) + 7 & "<BR>"<BR>%&#062;<BR><BR><BR>HTH<BR><BR>Jerry

  5. #5
    Join Date
    Dec 1969


    Thanks so very very very much! My boss wants this by tomorrow morning!!

Posting Permissions

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