Hi there,
I was wondering if it is possible to change the format/pattern of the Date displayed in the Input Controls?
Currently, when i select a date (using the Calendar), the date field is displayed as '12-01-2009', in my country, it is custom to use a dd-MM-yyyy pattern: '01-12-2009'. However, the input control does not accept this. Can i change this? and how :)
note: changing the pattern on the local resource does not seem to work
3 Answers:
Hey
I just figured this out myself recently.
Go to your folder corresponding to the following (depending of course of your jasper server version and installation path):
C:\\Program Files\\Jaspersoft\\jasperserver-3.5.0\\apache-tomcat\\webapps\\jasperserver\\WEB-INF\\bundles
and open up jasperserver_config.properties in a text editor. Simply swop around the month parts with the day parts, e.g.
date.format=dd-MM-yyyy
datetime.format=dd-MM-yyyy HH:mm
calendar.date.format=%d-%m-%Y
calendar.datetime.format=%d-%m-%Y %H:%M
After restarting you jasper server, your input control should now expect entries of dd-MM-yyyy when typing in the date manually, and also if you use the calendar control to select a date this will display as dd-MM-yyyy as well.
Of course the change will apply to all reports using date input controls on the same jasper server, but you do not have to change how your reports use the date objects. It is only how the user types the input.
It does not affect converting the Date object back to string either. You still need to do this yourself, e.g. using SimpleDateFormat.