4 Replies - 650 Views - Last Post: 01 December 2012 - 06:45 PM Rate Topic: -----

#1 cpetrey  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 09-February 11

Net working days in hours (non whole numbers)

Posted 28 November 2012 - 09:08 AM

Is anyone aware of a function (not using VBA)to calculate the networking days between two dates, but instead of it returning the number of whole days. For example, if I have a the dates
Start date = 11/12/12 16:05
End date = 11/13/12 17:08



I want it to return how many hours are between these two dates excluding weekends. I would want to function to return


Net working days = 1.xx




Is This A Good Question/Topic? 0
  • +

Replies To: Net working days in hours (non whole numbers)

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5625
  • View blog
  • Posts: 12,061
  • Joined: 02-June 10

Re: Net working days in hours (non whole numbers)

Posted 28 November 2012 - 09:21 AM

I think you're going to have to write that. There is no real standard for what are working hours.

Do you work from 8-5.... 9-6... Maybe you work swing shift from 1400-2200.
Was This Post Helpful? 0
  • +
  • -

#3 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Net working days in hours (non whole numbers)

Posted 01 December 2012 - 12:27 PM

Googling "vb6 weekend" reveals a solution on the first try. Took me less than one minute. Why wouldn't you try that too?
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5625
  • View blog
  • Posts: 12,061
  • Joined: 02-June 10

Re: Net working days in hours (non whole numbers)

Posted 01 December 2012 - 01:28 PM

Doesn't that get you the number of working versus non-working days?

The OP wants to calculate the number of working hours between two complete DateTimes.

Quote

Start date = 11/12/12 16:05
End date = 11/13/12 17:08



And I don't know of any built-in method that will do that because there is no way of saying whether or no the hour from 1700-1800 on Friday is a scheduled working hour. Yes it is an hour on a standard work day. But is the worker schedule until 1700hrs, or 1800hrs?
Or do you just assume that all the hours on a weekday are working hours, then from 1700 to 2400 would be 7 working hours?

Personally I think the OP needs to write a function that:
Checks the number of weekdays - easy, standard function.
Multiple by 24 to hours
Subtract the past hours off the beginning of the start day.
Subtract the remaining hours off the end of the end day.

That would get the net AVAILABLE weekday hours. But it won't be the *working* hours without factoring in the worker's schedule.

In this case verbiage is everything. Working hours verses weekday hours.
Was This Post Helpful? 0
  • +
  • -

#5 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: Net working days in hours (non whole numbers)

Posted 01 December 2012 - 06:45 PM

I see. Not too clear from his example...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1