Jump to content

Is there a way to subtract business hours from a timerange?


kenji4861

Recommended Posts

Say I have a function like

 

removeBusinessHours($timestampend, $timestampbegin)

 

which gives me the difference between the two times excluding business hours and let's assume business hours to be Weekdays 8am-8pm PST.

 

One ugly solution I can think of is to run through a loop for every second between $timestampbegin and $timestampend and do a check if it's in a business time and count++ if so, but this is a terrible solution.

 

Any easier way of doing this?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.