Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2003
    Location
    Washington, DC
    Posts
    116

    Unanswered: DateDiff That Only Counts Working Days

    Hi! I'm trying to create a query to calculate the number of days between two dates, but I only want to include working days. Is there a way to do this?

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    Most DBAs work seven days a week, weekends and holidays included . The provided DateDiff works fine for us!

    On a (very slightly) more serious note, what constitutes a "working day" by your definition?

    -PatP

  3. #3
    Join Date
    Sep 2003
    Location
    Washington, DC
    Posts
    116
    LOL, I definitely realize what days DBAs work...

    Working days are just the typical Monday through Friday.

  4. #4
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Vacations? Holidays? Snow days? Office closed due to threat of terrorist attack? Those all affect "working days". Or did you mean to ask "I'm trying to create a query to calculate the number of weekdays between two dates, excluding weekends."?
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  5. #5
    Join Date
    Jan 2005
    Location
    Green Bay
    Posts
    201
    Would you include Holidays as work days?

    IF not I would suggest you have a table calendar with field workday
    values 1 , 0

    sum the workday field to get your answer.

  6. #6
    Join Date
    Sep 2003
    Location
    Washington, DC
    Posts
    116
    Yes, this is what I'm trying to say:

    "I'm trying to create a query to calculate the number of weekdays between
    two dates, excluding weekends."

  7. #7
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

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