SAP Knowledge Base Article - Public

1542533 - How to change the date format of the date prompt

Symptom

How to change the default date format of "Datetime" parameter in Crystal Reports

Environment

  • Crystal Reports 2008
  • SAP Crystal Reports 2020

Reproducing the Issue

Create a report with date parameter and it prompts with Calendar and default format "mm/dd/yyyy"

Cause

This is By design and there is a workarond solution: 1652217

Resolution

WARNING: The following solution involves customizing product configuration files and not supported, Please use it at your own risk and note, the changes apply for all reports.

To change the date format we have to follow the below steps:

  1. Open the JavaScript file "calendar2.js" in Notepad from the location: C:\Program Files\BusinessObjects\Common\4.0\crystalreportviewers12\prompting\js\promptengine_calendar2.js

for Crystal Reports 2020 the file located at:  C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports\crystalreportviewers\prompting\js  

    2.   To change the default date format to "yyyy-mm-dd" of the "Date" type parameter change

          "this.dateFormat = dateFormat" to " this.dateFormat = "yyyy-mm-dd" " in the file

     3.  To change the default Datetime format to yyyy-mm-dd hh:mm:ss of the "Date" type parameter change

          " this.dateTimeFormat = dateFormat +  " " + "hh:mm:ss" " to " this.dateTimeFormat = "yyyy-mm-dd" +  " " + "hh:mm:ss" " in the file

     4.  Save the JavaScript file after making changes and restart Crystal Reports.

     5.  Check that now onwards the date format is yyyy-mm-dd.

 Note: List of available date formats are given in the file: C:\Program Files\Business Objects\Common\4.0\crystalreportviewers12\js\external\date.js

Keywords

Date format , KBA , BI-RA-CR , Crystal Reports designer or Business View Manager , How To

Product

SAP Crystal Reports all versions