Question
Aaseya IT Services Pvt. Ltd.
IN
Last activity: 4 Oct 2018 13:54 EDT
Date is getting off by one day
When we select a date in calender control which is of type DateTime, if we submit and come back to the same screen - date is decreasing by one day. This is case flow.
Need help any suggestions??
Message was edited by: Lochan to add Category
**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.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Pegasystems Inc.
US
Hi Sravani,
Can you please check if correct value is stored the clipboard after selecting the value in calendar control and submitting that assignment.
--Ravi
Aaseya IT Services Pvt. Ltd.
IN
Hi Ravi,
Thanks for the reply.
yes it is storing correct value including the time with GMT
Pegasystems Inc.
IN
Hello Sravani,
Briefly this is due to having used a Date Time property to represent a Date value.
A Date property would have been more appropriated in this case avoiding the occurrence of this issue.
More in detail the root cause is the particular combination of HTML controls used to assign a Date value to the Date Time property in the Work Item and for showing this property as date in the Report Definition.
Using the Calendar control in the section with Date mode means assigning 00:00 to the time part of the Date Time property.
With the time zone conversion being involved in this case the date time property is shifted to the day before.
E.g.. the date 20160101 in the Europe/Berlin time zone is converted to 20151231T230000.000 GMT
This is normally not an issue with Date Time properties as the opposite conversion happens when the date is retrieved from the database.
Suggested Solution:-
Use the appropriate property type whenever is possible to avoid the risk of incurring in this issue.
Assuming you cannot change your Data Model (which would be more correct) there are two mutually exclusive ways to work-around this issue:
Hello Sravani,
Briefly this is due to having used a Date Time property to represent a Date value.
A Date property would have been more appropriated in this case avoiding the occurrence of this issue.
More in detail the root cause is the particular combination of HTML controls used to assign a Date value to the Date Time property in the Work Item and for showing this property as date in the Report Definition.
Using the Calendar control in the section with Date mode means assigning 00:00 to the time part of the Date Time property.
With the time zone conversion being involved in this case the date time property is shifted to the day before.
E.g.. the date 20160101 in the Europe/Berlin time zone is converted to 20151231T230000.000 GMT
This is normally not an issue with Date Time properties as the opposite conversion happens when the date is retrieved from the database.
Suggested Solution:-
Use the appropriate property type whenever is possible to avoid the risk of incurring in this issue.
Assuming you cannot change your Data Model (which would be more correct) there are two mutually exclusive ways to work-around this issue:
- Create a custom HTML control to render the Date Time property as a Date and include this custom control in the Report Definition.
- Use a SQL function alias rule to adjust the SQL Date to the Application Server time zone.
The custom HTML Control can been created saving the OOTB Export_DateTime as Export_DateTime_Custom and changing line 8 of the HTML source
from: sDatetime = PRDateFormat.format(null, strTimeZone, PRDateFormat.DEFAULT_DATETIME_SHORT, curProp.toDate());
to: sDatetime = PRDateFormat.format(null, strTimeZone, "dd.MM.yyyy", curProp.toDate());
Adopt the Date pattern that best suits your needs.
The following screen shot depict the modified HTML Control with the current change highlighted:
The second solution albeit viable is less desirable as it depends on the database in use.
Aaseya IT Services Pvt. Ltd.
IN
Hi Ajit,
Thanks for the reply,
I found the same from PDN and did the same by creating the control and modified the step. Still the date is changing.
Pegasystems Inc.
IN
Hello Sravani,
Could you please let us know what is the column type use for the concerned property?
Also, you may perform the below test to narrow down the rootcause.
1. Create an activity with an Obj-Open method.
2. In the next step, do a show-page.
3. Now compare the concerned property value with its DB value.
Regards,
Ajit
Aaseya IT Services Pvt. Ltd.
IN
Hi Ajik,
Tried the same , Activity returns the same value as in the clipboard ,Suppose i have selected the Date as 30/05/2016 it is showing same but in RD the value is 29/05/2016.
Thanks,
Sravani
Pegasystems Inc.
IN
Hello Sravani,
Strange!! Ideally in both the scenarios, the value should be same.
Could you please check the below articles and verify if its can be helpful for your usecase.
https://community.pega.com/support/support-articles/report-shows-wrong-date-external-table-db2
Also, please share the screenshot of RD.
Regards,
Ajit
Pegasystems
US
Here are a number of things to check:
1) Do you ever take a date, change it to a date-time, then change it back to a date? This can cause the kind of problem you're seeing, Or vice versa.
2) What time zone is your db server set to compared to the time zone of your app server? Make them the same!
3) If a time stamp is too close to midnight, or too close to the "top of the hour", such things can happen. If possible, stay away from those confusing times when using time stamps. For instance, use 12:05 instead of 12:00.
/Eric
Aaseya IT Services Pvt. Ltd.
IN
Hi Eric ,
Thanks for the response,
1.NO there is no change.
2,3 dint get you can u pls elobarate
CIGNA
US
Hello All ,
we are also facing same issue , could you please provide me the solution .
Thanks,
Srini
Pegasystems Inc.
IN
Hi,
Thank you for posting your query in the PSC. This looks like an inactive post and hence, we suggest you create a new post for your query. Click on the Write a Post button that’s available on the top right pane of this page. Once created, please reply back here with the URL of the new post.
You may also refer this discussion link as a reference in the new thread.