Last activity: 16 Oct 2018 12:03 EDT
add days to datetime property using business days
I would like to add days to a datetime using only business days. The function DateTime.addToDate add a number to a date but doesn't use only business days.Are there any functions that add number to a datetime using only business days?
**Moderation Team has archived post**
This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.
Business days is not a standard defined set of days and may vary depending on place, organization and on other factors. There may also be holidays which will not be considered as a business day thus the definition is dynamic in nature.
I am assuming you are referring to Mon-Fri weekdays by business days. You may thus have to write a custom function to achieve this.
I am trying to use Calendar rule to calculate days which will cover Monday to Friday and Holidays too. I have found 2 functions also but somehow those I am not able to provide because of error "rule instance not found".
pxAddTime and TimeDifferenceBusinessDays are those 2 functions.
Try saveas the function in your local ruleset or create a new function with the same code.
I have tried this but getting same instance not found error.
Blue Rose Technologies GmbH
Try this :
- @(Pega-RULES:BusinessCalendar).addDays(<PROPERTY>, <Integer of days to add>, true (consider business calendar), OperatorID.pyCalendar (get operator calendar))
- if passed from agent -- please pass OperatorID.pyCalendar as parameter.
I tried this option but this function return only Date portion and I am looking for DateTime value in return.
I am also facing the same issue if someone have solution please share, Thanks in Advance.
What is the use case you are trying to solve? You can also utilize functions which calculate the difference between dates --> @(Pega-RULES:BusinessCalendar).differenceBetweenDays
I need to get the difference between 2 dates excluding the weekends
Unfortunately my original reply did not include the images.
Thanks a lot for the response, I am aware of those functions but my requirement is bit different.
The function differencebetweendatetimes gives the difference in seconds based on the business calendar and business hours.
But my requirement is something like below.
My Start Date is 20170908T102818.445 GMT and End Dtate is 20170911T102818.445 GMT i should get the difference by excluding sunday and saturday alone that means i should get the difference as 1 day. But the above function differencebetweendatetimes is giving output as
@differenceBetweenDateTimes("20170911T102818.445 GMT","20170908T102818.445 GMT",true,"") == 32400 Seconds
It's totally calculating based on business hours for one day means it's returning 9 hours but in my case i need to get the time in 24 hours format, 1 day means 86400 Seconds.
For example when i am using as @differenceBetweenDateTimes("20170911T222818.445 GMT","20170911T212818.445 GMT",true,"") i am getting the difference as 0 seconds but it should return the value as 360 Seconds ie 1 hour
Thanks for all the help.
I got the issue resolved, actually when we use @differenceBetweenDateTimes(Param.StartTime,Param.EndTime,True,"");
when the calendar parameter is blank it takes the Calendar as Default, Default calendar is an instance so i have saved as the default calendar instance, earlier the time was mentioned as 08000 to 170000 that the reason it was giving as 9 hours range i have changed that to whole day as working so now gives result in 24 hours range.
can i know how to open the that instances of function tab above
How about getAsBusinessDay function. I tried it but its not working as intended.
ATOS Origin IT Services PVT Ltd
Hi i am taking 2 inputs using datetime and want to calculate the number of business days between them ! Please explain what exactly did u do
i think your question is answered by shoaib.