Posted: 28 Dec 2016 2:55 EST Last activity: 19 Jan 2017 2:44 EST
addDays(String, int, boolean, String) is inconsistent. When 1 business day is added to the date I am getting the result as the same day as input
We have a requirement where we need to add(1 or 2 or 5) days to the case creation date. I am using the addDays() functon where I pass a dateTime and add number of days accoriding to the requirement. We are using our own calendar which is set in CST time zone and have our set of holidays defined. We are storing the result in DateTime property. We are facing inconsistency where when we add one day to the dateTime passed we are getting the same date. Like, if I pass "20161228T150000.532 GMT" and add one day using addDays(DateTime, 1, true, CalendarName) I am getting the result as "20161228T183000.000 GMT". We are facing the issue only in UAT testing environment. We are not facing the issue in lower environments. The only differene I could find between the two environments is that lower environment server is located in CST time zone and UAT environment server is located in EST time zone.
One important thing to note is that we are facing the issue only when we are running the function before 3PM IST(Indian Standard Time). We are not facing the issue after 3 PM IST on the same day even though we pass the same "20161228T150000.532 GMT" value.
***Updated by moderator: Lochan to add Categories***
I checked the property and it is set as false. I also was able to track down some more things in the problem. The issue happens only if the operator ID is set to IST timeZone. Is there a way to solve this problem so as to get the date regardless of the timezone of the operator
Typically you can always expect problems when using "Date" functions with a DateTime Property; especially if your timezone is ahead of GMT. In this instance it would be better to have a new "Date" Property, eg. CreateDate and then use this for your "calculations". You can probably set the value using a Declarative Expression based upon pxCreateDateTime.