A little help from my friends

Results 1 to 8 of 8

Thread: A little help from my friends

  1. #1
    Heaven's Martini Guest

    Default A little help from my friends

    Hey all.<BR><BR>came across a problem. I have a solution, but I think its<BR>"taking the long way around the barn" approach to the problem<BR><BR>Hope someone has a better idea.<BR><BR>Essentially, the user chooses a range of dates<BR>could be any range,<BR>hours, minutes,days,months,years.<BR><BR>And for that range,<BR>I need to iterate through all the days and display some data.<BR><BR>so if they have 4/28/2001 - 5/3/2001<BR>i need a way to list<BR>4/28/2001<BR>4/29/2001<BR>4/30/2001<BR>5/1/2001<BR>5/2/2001<BR>5/3/2001<BR><BR>But of course done, entirely programmaticaly.<BR>It could cross many months or even years.<BR><BR>Just wondering if someone knows of a shorter version of what I see as being a pretty large chunk of code.

  2. #2
    Join Date
    Dec 1969

    Default Hmmm

    I assume you want to pull records from that range from a db? If so Bill W wrote an FAQ for just that. If not post back with more specifics.<BR><BR>http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=59

  3. #3
    Eddie Campbell Guest

    Default RE: A little help from my friends

    I haven&#039;t tested it, but something like this should work.<BR><BR> StartDate = "4/28/2001"<BR> EndDate = "5/3/2001"<BR>&#039;<BR> NumOfDays = DateDiff("d",StartDate,EndDate)<BR> NewDate = StartDate<BR> For I = 0 to NumOfDays<BR> Response.Write DateAdd("d",I,StartDate)<BR> Next

  4. #4
    kpw Guest

    Default RE: A little help from my friends

    You didn&#039;t post what you had tried already! (Maybe you haven&#039;t actually created any code!)<BR><BR>I think I actually had to do this once, but I can&#039;t remember what I did. But, if I had to do it again, I think I would try something like in the following semi-pseudo-code:<BR><BR>&#039; ------------------------------------------------------<BR>Dim datBaseDate<BR>Dim datEndDate<BR><BR>Dim intDaysDifference<BR><BR>Dim i<BR><BR>datBaseDate = first date in range<BR>datEndDate = last date in range<BR>intDaysDifference = DateDiff(Days, datBaseDate, datEndDate)<BR><BR>For i = 1 to intDaysDifference<BR>Response.Write CStr(CDate(datBaseDate + i))<BR>Next i

  5. #5
    Heaven's Martini Guest

    Default I am the...

    f*in idiot i thought.<BR><BR>I was over complicating something I knew wasn&#039;t that hard.<BR><BR>Thanks.<BR><BR>This has been one of those weeks, let me tell ya.<BR><BR>Well, when ya&#039;ll are at work tomorrow, I am going to be<BR>3 sheets to the wind. :)

  6. #6
    Eddie Campbell Guest

    Default Drunk again eh ?

    I take it you are refering to the cocktail of course<BR><BR>http://www.barmeister.com/cgi-bin/drink.view.pl?drink=10<BR><BR>or did you mean this<BR><BR>http://kidrock.htmlplanet.com/lyrics/3sheetstothewind.html<BR><BR>Have fun

  7. #7
    Heaven's Martini Guest

    Default fyi

    Just so ya know.<BR><BR>There is a reason, I was only talking theory. My code was just garbage.<BR><BR>For some reason I was thinking dateadd would return to the beginning of the month, mental breakdown, either that or i killed that braincell.

  8. #8
    Heaven's Martini Guest

    Default Sober actually.

    Well<BR><BR>I didn&#039;t know kid rock had a song.<BR>(Blues Fan)<BR><BR>as for that drink, ick.<BR>i stick to the basics, vodka martinis,single malt scotch,bourbon,Aquavit(spelling?),red wines,and of course exceptional beers.

Posting Permissions

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