User is selecting “Received DateTime” and 30 hours need to add into selected date time “Received DateTime”
But I have to make sure that 30 hours should not add directly it should add according to business hours (8am to 8pm daily) and weekend is on “Friday” and “Saturday”
Please help on above it will be highly appreciable
So your logic is:
A day is 12 hours long.
For a given date-time, Add 30 business hours. (Add 2 days and 6 hours). The following steps apply:
Establish Valid Start Time:
If Hour < 8 AM, set hour = 8 AM.
If Hour > 8 PM, add a day and set hour to 8 AM.
If Day = 5: Add 2 days, set hour to 8 AM.
If Day = 6: Add 1 day, set hour to 8 AM.
Skip any weekends:
If Day = 3,4; add an additional 2 days (to skip the weekend).
If Day = 2 and Hour >= 2PM, add an additional 2 days to skip the weekend.
Add 2 days and 6 hours.
Then check for wraparound:
If Hour >= 8 PM, add a day and set hour = 8 AM + (Hour - 8 PM) Hours.
I am a beginner Please provide the code also if possible for you
Try it yourself, and we’ll help you to adjust it.
I suggest looking at the various functions available to the [FPHP]DateTime[/FPHP] class.
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.