Crystal Reports Parameter Input dialog box changing the date format

4.8k Views Asked by At

When I generate a report that expects two date parameters, I first see the dialog box titled 'Enter Values' and the dialog box contains two text boxes with its own date picker widget. However, once I pick a date and click 'OK', the date is formatted as 'dd/MM/yyyy'. Does anyone know if it is possible to configure the report in a way so that the date format matches Windows system locale short date format? Instead of just defaulting to dd/MM/yyyy?

Thanks!

2

There are 2 best solutions below

2
On

The date format for the parameter can't be changed, at least as far as I know. If you want the date displayed in a different format, you can always create a formula:

"From : " & ToText(Minimum({?date}), "M-d-yy") & 
" To :" & ToText(Maximum({?date}), "M-d-yy")

Or you can go into the File menu, click on Options and under the Fields tab, there is a button for Date. Click on that and you can choose the format under the Date tab. This is for CR 2008, so it may be slightly different for CR XI.

0
On

If You are trying to filter in your SQL on date range field then you can add castings on dates. Like

    datarangeField between cast({?Start Date} as date format 'm-d-yy')
                         AND cast({?End Date} as date format 'm-d-yy')

Also, you are required to add these (Start Date and End Date) in your SQL Parameters during Adding the query.

For display you can use formulas and format field options.