SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy Please help..how many workdays it took to close a call.

    Hi there
    I really hope you guys can assist me with this.
    I am writing a call logging system, .....no problem.

    PROBLEM
    I have to query the db ( access) to find out how long it took to close the call.
    Between startdate and enddate
    It must count only workdays, no weekends (holidays is not a problem).
    using asp

    Please ...does anyone have any idea.

    "I'm stuck"

    Thank you
    Albert

  2. #2
    SitePoint Addict danfran's Avatar
    Join Date
    Jan 2005
    Location
    New York City
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm not saying there's no easier way, but...

    You should definitely learn how to use the Weekday function:
    http://msdn.microsoft.com/library/en...fctWeekday.asp

    and the DateDiff function:
    http://msdn.microsoft.com/library/en...ctDateDiff.asp

    Simply put, you could find the number of weeks between the two dates, subtracting 2 for each week, then using a secondary calculation involving the number of biz days floating around the first date and then again around the 2nd date.

    If you are worried about the accuracy of such calculations, maybe you could simply do a loop from 1 to n where n is the #of days diff between the start and end dates. Each time you go through the loop, calculate the day of the week of the nth day since the first call. For each business day (weekday fn is between mon-fri), keep count using "bizday = bizday + 1" and then increment n so that the next time you go through the loop, you're calculating the dayofweek of the next day since the first call. When you get to the end date, your sum should be ready.

    Dan

  3. #3
    Guru Bullschmidt's Avatar
    Join Date
    Apr 2002
    Location
    USA
    Posts
    524
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or:

    NumOfWeekdays = DateDiff("w", Date1, Date2)
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips


Bookmarks

Posting Permissions

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