Jump to content
Changes to the Jaspersoft community edition download ×

Problem with locale


eldire

Recommended Posts

so that a report when recovering the date shows the months to me in English, in spite of to have selected in locale the Spanish
If I execute the SQL in oracle is no problem, but I have problems from jasperserver I have proven the same report in another machine with jasperserver 3,1 and against the same oracle and works well.

Some Idea?.

Jasperserver 3.5

oracle 11G

Sorry for my bad English but this translation I have done it with Babel fish
Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

eldire,

iReport makes it easy to set a date format in a date field. This is useful in many cases. You do not want this, because it will hard-code the format.

To get a date to display correctly in a locale-dependent way create a text field like this:
DateFormat.getDateInstance(DateFormat.SHORT, $P{REPORT_LOCALE}).format( $F{MyDateField} )

That converts a java.util.Date into a String representation of the date and takes the locale into account.

Regards,
Matt

Link to comment
Share on other sites

I feel I believe it that I have not explained myself well, the problem is that I use a consultation that uses sysdate to obtain the date of the system, which I put on the foot of the report. I do if it in oracle gives back Marzo to me, I do but it in Jasperserver gives back March to me. What can be the problem? It can be the operating system.
Link to comment
Share on other sites

eldire,

If you use "sysdate()" in an Oracle query it does not return "Marzo". It returns a date object. (This is probably represented internally as a number of milliseconds since the epoch... but that detail is not important.) The default way of formatting this date depends on various settings. So because of your server settings and your client settings you see "Marzo".

JasperServer receives this same date object. Because of certain settings you are seeing this date object get formatted to "March".

But it's possible to tell the report to format this date object differently. Did you try the sample code I posted?

Regards,
Matt

Link to comment
Share on other sites

  • 4 years later...

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