Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Only business hours Post Reply Post New Topic
Author Message
JackieB
Newbie
Newbie
Avatar

Joined: 09 Mar 2009
Location: United States
Online Status: Offline
Posts: 1
Quote JackieB Replybullet Topic: Only business hours
     Posted: 09 Mar 2009 at 2:19pm
I have a requirement to find the amount of time between when a document was started and when it was finished. I only want to count the times during business hours. How could I do this?
 
What I have:
TIME(0,0,0) +
(TIME({Sheet1_.Completion time}) - TIME({Sheet1_.Start time}))
 
 
Thank you for any help.
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Quote lockwelle Replybullet Posted: 11 Mar 2009 at 7:31am
Here is the general idea.  Determine the time difference between start and end. Determine the number of days between them as well.  Subtract from the time difference the (number of days * time that is not business hours)...I don't know if you are measuring in days, hours, or minutes.  This covers most cases.  Just because you know it will happen, you will probably want to determine the number of weeks or if the range of dates covers a weekend (if the business is closed for them) and then subtract the number of closed days by the business hours (the non-business hours are already accounted for). 
 
How can we know if the dates crossed a weekend? Use the DayOfWeek function.  If the end date value is less than the start date, you crossed a weekend.  If you are also counting weeks, you will need to adjust for that, but this should give a good start.
 
Hope it helped
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum