Jump to content
We've recently updated our Privacy Statement, available here ×

changing date format/pattern in input control


sjongenelen

Recommended Posts

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.jpg

note: 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

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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.

 

Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...