whether and what extend is timezone auto converion supported

  • Environment

JasperServer (6.0.1) and AWS Redshift database (the latest version) of UTC timezone. The local timezone for experiment is UTC+8.

  • Purpose

Fully support local timezone to run report, i.e., the input and output date/time are based on the local timezone.

For example, if an user queries data of the date 2015-11-05, i.e., [2015-11-05 00:00:00, 2015-11-06 00:00:00), then two conversions are desired, 1) convert the local time to UTC [2015-11-04 16:00:00, 2015-11-05 16:00:00) and then query against UTC-based database; 2) convert database resultset back to UTC+8 [2015-11-05 00:00:00, 2015-11-06 00:00:00) to be of local timezone.  

  • Report

Input: there exists two input parameters to indicate the period of data to query;

Output: there exist one output filed of java.sql.Timestamp to indicate the timestamp of this record;

  • Questions
  1. Whether is the scenario above supported or not? if yes, what is right way to achieve it? if not fully supported, then what extend can it be supported?
  2. The observation during fail and trial is: 1) if the inputs are set as the type 'java.sql.Timestamp' then the first conversion can happen automatically, but if the type is set as 'java.util.Date' then it will not happen. Is that expected? For the second conversion, it never happened, do we have to do it ourselves?


BTW, I already managed to know how to pass the local timezone to JasperServer (userTimezone) and how to retrieve it in JasperServer wherever needed (TimeZoneContextHolder).


171334125's picture
Joined: May 6 2015 - 8:12pm
Last seen: 7 years 10 months ago

0 Answers:

No answers yet