Jump to content
JasperReports Library 7.0 is now available ×

Change Timezone


2004 IR Help

Recommended Posts

By: LeeBar - leebar

Change Timezone

2005-11-10 18:04

Hi

 

Is there a way to tell Jasper to use a different timezone than the system one to format dates? For our application users might be logged in at one part of the world (e.g. Switzerland) and create reports for another part of the world (e.g. Panama). The date saved as UTC in the database should be formatted by the timezone of the remote location (Panama) and not of the system the user works on...

It would be convinient to tell the jasper engine what timezone to use - otherwise I would have to create Scriptlet based field handling for each date field.

 

Thanks for any input!

Lee

 

 

 

 

 

By: LeeBar - leebar

RE: Change Timezone

2006-01-03 16:07

I try again with that question: can I define the timezone to be used by Jasper to convert dates for display? In our application, the client's system timezone is not the one that should be used for displaying dates in reports.

 

Thanks for any input!

lee

 

 

 

 

By: Ilyas Bakirov (aka eRIC) - just_ilyas

RE: Change Timezone

2006-01-04 02:34

leebar

 

You can use REPORT_LOCALE parameter. As your web application has requst :) so it has locale variable so pass it to report as REPORT_LOCALE parameter.

 

Then you can use SimpleDateFormat(for my case) or similar which can render date/time according to locale(locale and country code).

 

as an example(I use my report and this is what i do in my case)

 

I have field or static textfield and java.util.Date variable dt so in textfield i render date:

new SimpleDateFormat("dd/MM/yyyy").format($F{dt})

 

So you can do the same tricks for dates to render by locale. I think this will help

 

 

 

 

 

 

By: LeeBar - leebar

RE: Change Timezone

2006-01-04 12:21

Great! I will test that right away!

Thank you -- Lee

 

 

 

 

By: LeeBar - leebar

RE: Change Timezone

2006-01-04 17:59

hmm - A java.util.Locale does not really have an idea of a timezone. As I understand it represents language and country, but it does not influence the time conversion from the (utc) Date value to the displayed date value. Considering that e.g. US has 3 timezones but only one locale (Locale.US) I think this does not help to resolve my problem...

Any ideas?

 

Lee

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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