DateDiff Help

Results 1 to 2 of 2

Thread: DateDiff Help

  1. #1
    Bob Edison Guest

    Default DateDiff Help

    I&#039m trying to loop through a table and add up all the days in between to dates. I&#039m trying to get the average flow days. I&#039ve been trying to use the following code:<BR>TotalAheadDiffADate = DateDiff("d", ShopConn("ActualFinish"), ShopConn("Comp")) <BR>TotalAheadDiffADate = TotalAheadDiffADate + TotalAheadDiffADate<BR><BR>It doesn&#039t seem to be adding up the total days. Can you help Please?

  2. #2
    sm549 Guest

    Default RE: DateDiff Help

    You&#039re assigning the difference to the total before adding it to the total. The result is twice the last difference. Try using a separate variable for the row fetches, &#039Difference&#039. Also make sure TotalAheadDiffADate is initialized to zero at the start of the calculation, before the loop.<BR><BR>&nbsp&nbspDifference = DateDiff("d", ShopConn("ActualFinish"), ShopConn("Comp")) <BR>&nbsp&nbspTotalAheadDiffADate = TotalAheadDiffADate + Difference<BR><BR>Hope it helps.<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