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

Time Value does not display in Export to Excel

SA-15651

Summary



Time values which display in List  View do not display correctly in Excel when the report content is exported. For example, a date time field that displays in the List View as:

01/01/2015 02:03:56 AM

displays in Excel as:

01/01/2015 02:03:00 AM


Error Messages



Not Applicable


Steps to Reproduce



Create a List View with date time property values and export the content to Excel.


Root Cause



Please see SA-14686 (http://pdn.pega.com/node/347451) for root cause information. 

Resolution



Perform the following local-change: 

Below code converts the date into required format. Save this code in a custom control and use the control in "Export Excel" cell for the date field in List View.


< div class="excel-datetime" style="vnd.ms-excel.numberformat:MMM d, yyyy hh:mm:ss a">
< %
ClipboardProperty curProp = tools.getActive();
if ((curProp.getType() == PropertyInfo.TYPE_DATE || curProp.getType() == PropertyInfo.TYPE_DATETIME)&& curProp.size() > 0 && curProp.hasValidValue() && curProp.toDate()!=null)  {
                String sDatetime="";
                String type = tools.getParamValue("DateTimeFormat");
                String strTimeZone = tools.findPage("pxRequestor").getString(".pyUseTimeZone");

                sDatetime = PRDateFormat.format(null, strTimeZone, "MMM dd,yyyy hh:mm:ss a", curProp.toDate()); 
                                                
                tools.putSaveValue("result",sDatetime); 
}
else {
                tools.putSaveValue("result",tools.getActiveValue()); 
}

%>
< pega:reference name="$save(result)" />
< /div>
Suggest Edit

Published January 31, 2016 - Updated October 8, 2020

Did you find this content helpful? Yes No

Have a question? Get answers now.

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

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