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

how to change parameter's format?


niennamiriel

Recommended Posts

I had a question about parameter's on ireport. I had a parameter with java.util.date class. When I run the report, It shows format like 'Wed 06/10/2009'
but I want format like '10/06/2009' Can I change that or is that only way to be shown?



Post Edited by niennamiriel at 08/19/2009 08:28
Link to comment
Share on other sites

  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

There isn't an answer, yet - I had the same problem (hence the previous post to which you refer), and have reported it as a bug. A Parameter SHOULD (in my view) take on the Locale of the system on which it is installed. It doesn't, and I have not yet found a way of changing the format of a Date Parameter (it is relatively easy to format a date Variable - right click on it, and use Field Pattern - but you can't format a Parameter that way).
Link to comment
Share on other sites

As far as I can understand, you are asking how to change the date format of your parameters when you run a report and when you are prompted to enter these ones.

I had the problem when running my reports in jasperserver : I edited the files "calendar.properties" and "jasperserver_config.properties" in $tomcat/webapps/jasperserver/WEB-INF/bundles and I got the wanted formats.

When I run the report from iReport, I get also the right format.

Hope this Helps

Link to comment
Share on other sites

dgiulian,

 

You should start a new thread for this topic.

 

In general though, you should not convert a date parameter into a string for use in your query. You end up with code like this:
WHERE
     TO_CHAR($P{MyDate},'yyyy-mm-dd') < [some other data converted to a string]

 

In most cases you're better off leaving dates and dates and comparing them. Or you should perform date functions on them (e.g. return the month and compare those). But casting the dates to strings and comparing them is generally bad for performance and bad for maintenance.

 

Having said that... maybe you've got a good exception.  ;-)
Go ahead and add some details in a new thread.

 

Regards,
Matt

Link to comment
Share on other sites

  • 7 years later...

I'm rather asking for help. I have a problem, the date a get from input in form seems to have an invalid format for jasper query. I hardcoded '10-01-2016' for example and query was succesful. But when I use the parameter it returns empty resulta. What can I do?

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