sjongenelen Posted December 23, 2009 Share Posted December 23, 2009 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 :)/uploads/projects/jasperserver/23-12-2009%2010-15-52.jpgnote: changing the pattern on the local resource does not seem to work/uploads/projects/jasperserver/23-12-2009%2010-14-26.jpg Link to comment Share on other sites More sharing options...
msn Posted December 23, 2009 Share Posted December 23, 2009 HeyI 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\bundlesand 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-yyyydatetime.format=dd-MM-yyyy HH:mmcalendar.date.format=%d-%m-%Ycalendar.datetime.format=%d-%m-%Y %H:%MAfter 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. Link to comment Share on other sites More sharing options...
sjongenelen Posted December 23, 2009 Author Share Posted December 23, 2009 thank you for your quick and precize reply; worked like a charm! one question though; i presume the Date input field is passed as a Date object (java.util.date?) to the JRXML? if so, there will be no problem with existing report units :) Link to comment Share on other sites More sharing options...
msn Posted December 23, 2009 Share Posted December 23, 2009 Yes, it will still be passed to your report as a Date object. You only change the input format, as the system needs to know how to parse the string to make the date object. 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now