Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

System incorrectly handles Feb, 29 and produces errors

SA-20633

Summary



For case updates, the system shows errors on screen instead of update:
RiskBasedExpiryDate:58775210303 is not a valid date value.

The system incorrectly handle Feb, 29


 


Error Messages



RiskBasedExpiryDate:58775210303 is not a valid date value


Resolution

Local-Change can be found below:
 
//
You can use this code directly in activities via a java step or introduce new Rule-Utility-Function with the following code. 
 
int year= 2017;
int month = 02;
int day = 29;
 
                                java.util.Calendar calendar = java.util.Calendar.getInstance();    
                               
                                // set time to Calendar start date
                                calendar.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
                                calendar.set(1970, 0, 1, 0, 0, 0);
                                calendar.set(java.util.Calendar.MILLISECOND, 0);
                                Date beginDate = calendar.getTime();
                                calendar.clear();
                               
                                // set time to given input date
                                calendar.setTimeZone(java.util.TimeZone.getTimeZone("GMT"));
                                calendar.set(year, month -1, day, 0 ,0 ,0);
                                calendar.set(java.util.Calendar.MILLISECOND, 0);
                                Date endDate = calendar.getTime();
                               
 
double nBeginTime = (double) beginDate.getTime();
                                double nEndTime = (double) endDate.getTime();
 
                                double nTimeDifference = nEndTime - nBeginTime;
 
                                nTimeDifference = nTimeDifference / 1000.0;
                                nTimeDifference = nTimeDifference / 60.0;
                                nTimeDifference = nTimeDifference / 60.0;
                                nTimeDifference = nTimeDifference / 24.0;
                               
                                double diffInDays = java.lang.Math.floor(nTimeDifference);
                               
 
                                oLog.infoForced( "modified:"+BigDecimal.valueOf(diffInDays)   );
 
//

Published March 19, 2016 - Updated October 8, 2020

Was this useful?

0% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us