Gosu methods for business hours

The methods addBusinessHours and businessHoursBetween on the Date entity add business hours to dates or compute business hours between specific dates. Depending on the parameters, these methods can take into consideration holiday types or zones. The methods also use the settings for business hours, days, and weeks in the config.xml file.

The methods are defined in gw.util.GWBaseDateEnhancement, and you call them by using a Date object.

While certain methods might appear to be similar, they can have different results.

  • The method addBusinessDays works differently from addBusinessHours. For example, in the base configuration, a business day runs from 8:00 a.m. to 5:00 p.m. Adding one business day to Sunday 12:00 a.m. results in Monday 12:00 a.m. However, adding nine business hours to Sunday 12:00 a.m. results in Tuesday 8:00 a.m. In the base configuration, for calculation purposes, a business day includes the times 8:00 a.m. through 4:59 p.m. Therefore, adding 9 hours to a weekend day goes past the next business day, Monday, to 8:00 a.m. the following day, Tuesday.
  • The method businessDaysBetween works differently from businessHoursBetween. If the business day is between 8:00 a.m. and 5:00 p.m., calling businessDaysBetween for Sunday 12:00 a.m. and Monday 12:00 a.m. returns a value of 1. Calling businessHoursBetween for Sunday 12:00 a.m. and Monday 12:00 a.m. returns 0.