Support Article
Cannot create yyyyMMddTHHmmss.SSS format
SA-90627
Summary
When using the FormatDateTime API to set the DateTime parameter value in an activity with the below format, errors are generated in the logs during the execution of the API.
@(Pega-RULES:DateTime).FormatDateTime(.DateTime1, "yyyyMMddTHHmmss.SSS", "EST", "CANADA")
Error Messages
[WebContainer : 7] (pub.util.PRDateFormat) ERROR - Cannot create format "yyyyMMddTHHmmss.SSS", default format is used
java.lang.IllegalArgumentException: Illegal pattern character 'T'
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:837)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:645)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:616)
at com.pega.ibm.icu.impl.pega.LocaleElements.getSimpleDateFormat(LocaleElements.java:1373)
at com.pega.ibm.icu.text.SimpleDateFormat.<init>(SimpleDateFormat.java:93)
at com.pega.pegarules.pub.util.PRDateFormat.createRealFormat(PRDateFormat.java:1838)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:508)
at com.pega.pegarules.pub.util.PerThreadCache$1.get(PerThreadCache.java:313)
at com.pega.pegarules.pub.util.PerThreadCache.getFormat(PerThreadCache.java:267)
at com.pega.pegarules.pub.util.PRDateFormat.format(PRDateFormat.java:501)
at com.pega.pegarules.exec.internal.util.PRDateTimeUtilsImpl.formatDateTime(PRDateTimeUtilsImpl.java:679)
at com.pegarules.generated.FormatDateTime_071017_v7CuBlyVOsNOstghDIb1pw.FormatDateTime07_10_17(FormatDateTime_071017_v7CuBlyVOsNOstghDIb1pw.java:129)
at com.pegarules.generated.FormatDateTime_071017_v7CuBlyVOsNOstghDIb1pw.invoke(FormatDateTime_071017_v7CuBlyVOsNOstghDIb1pw.java:76)
at com.pega.pegarules.generation.internal.library.LibraryRuntime.resolveAndinvokeFunctionViaReflection(LibraryRuntime.java:133)
Steps to Reproduce
- Create an activity.
- Set the DateTime parameter value to use the FormatDateTime API.
- Run the activity.
Root Cause
T and dot (that is, '.') are the Constants in the format, and the last argument is not the country.
Resolution
Perform the following local-change:
- Escape the Constants with a single queue.
- Provide the locale value to the last argument as below,
@(Pega-RULES:DateTime).FormatDateTime(.DateTime1, "yyyyMMdd'T'HHmmss'.'SSS", "EST", "en_CA")
Published March 28, 2020 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.