Calculate the end date(SLA) from its start date in business hours

I need to calculate end-date/SLA for a given start-date considering the completion-time in minutes within the business hours/days.

For instance :

  • start-date = 2023-03-17 15:00:00
  • completion-time = 240 (minutes)

Considering 9 working hours per day(9am to 6pm) and weekend on Saturday Sunday. The end-date should be 2023-03-20 10:00:00.

So the total hours are 4,

  • on 2023-03-17 from 15:00:00 to 18:00:00 (3 hours)
  • on 2023-03-18--- Saturday
  • on 2023-03-19---Sunday
  • on 2023-03-20 from 09:00:00 to 10:00:00(1 hour) complete sla

Any help with regards to this would be much appreciated.

So far i can able to get the total working days excluding the weekends but getting exact end time is where i'm struggling.

Thank you.

Parents
  • Hi ,

    It's not clear from your use case if a code customization is required or if SugarBPM is acceptable to meet your needs. SugarBPM can be used in conjunction with the Business Centers module to meet this specification. First you would create a business center record with your desired operating hours:

    Then, in the BPM defintion, when setting a datetime field like task due date or case follow up date, you can choose to set the time based on the run time + x business hours:

    Even if you are looking to do a code customization, I recommend leveraging the Business Center module as part of that customization so that you have more accessible control to modify the operational hours. You also have additional benefits such as defining business holiday exceptions and explicit users belonging to a business center.

    Chris

Reply
  • Hi ,

    It's not clear from your use case if a code customization is required or if SugarBPM is acceptable to meet your needs. SugarBPM can be used in conjunction with the Business Centers module to meet this specification. First you would create a business center record with your desired operating hours:

    Then, in the BPM defintion, when setting a datetime field like task due date or case follow up date, you can choose to set the time based on the run time + x business hours:

    Even if you are looking to do a code customization, I recommend leveraging the Business Center module as part of that customization so that you have more accessible control to modify the operational hours. You also have additional benefits such as defining business holiday exceptions and explicit users belonging to a business center.

    Chris

Children