Comparing two date arrays

Results 1 to 2 of 2

Thread: Comparing two date arrays

  1. #1
    Join Date
    Dec 1969

    Default Comparing two date arrays

    Heres my situation. A user is renewing an item. I have two arrays. One array contains dates that that item is reserved for. ie 1/3/01, 2/4/01 etc. The other array contains a months worth of dates starting from the date the user wanted to renew the item. I then want to step through the array which contains a months worth of dates, one day at a time and compare it the the array of reserved dates. If it finds a date that matches, then it moves on to the next date in the reserved array. If it finds a date that doesn;t match, it adds it to another array called freedates. Then both arraies move on to the enxt element. Heres the code (testdates contains a months worth of dates, enddate is set to the the last value in that array. reserveddates is the array of reserved dates. emptyday array is used to store free dates.:<BR><BR>Basically, it does nothing. Whats wrong?<BR><BR> do while ((datevalue(testdates(counter6))) &#060;&#062; (datevalue(enddate))) <BR><BR> if ((datevalue(reserveddates(counter5))) &#060;&#062; (datevalue(testdates(counter6)))) then<BR><BR> Rem Must be a free date<BR><BR> counter6=counter6+1<BR> emptyday(counter7)=testdates(counter6)<BR> counter7=counter7+1<BR> <BR> else<BR><BR> Rem Date must be reserved<BR> <BR> counter5=counter5+1<BR> <BR> End if<BR><BR><BR>loop<BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default Bill's mantra: DEBUG DEBUG DEBUG

    If you would simply print out the various dates that are being compared, you&#039;d see the error in your logic right away!<BR><BR>If you do that and still can&#039;t figure it out, then ask me again.<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