Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Problem with date params(start/end date params are one hour off)
Problem with date params [message #762889] Thu, 08 December 2011 19:21 Go to next message
A N is currently offline A N
Messages: 15
Registered: December 2011
Junior Member
When I run a report through the BIRT report designer (2.3.2), there is a discrepancy between the date parameters that I put in for the start and end date, and the start and end dates that are actually displayed if I try to output them to a log file.

The problem seems to only occur for dates between October 10, 2011 to October 16, 2011.

For instance, if I set my start date parameter to 10/10/2011 and my end date parameter to 10/16/2011, I receive the following log output:

Fri Nov 18 15:31:27 BRST 2011 DEBUG startdate: Sun Oct 09 23:00:00 BRT 2011
Fri Nov 18 15:31:27 BRST 2011 DEBUG enddate: Sat Oct 15 23:00:00 BRT 2011

What I expected was:

Fri Nov 18 15:31:27 BRST 2011 DEBUG startdate: Sun Oct 10 00:00:00 BRT 2011
Fri Nov 18 15:31:27 BRST 2011 DEBUG enddate: Sat Oct 16 00:00:00 BRT 2011

If I were to choose 10/10/2011 to 10/11/2011, I would receive the following output:

startdate: Sun Oct 09 23:00:00 BRT 2011
enddate: Mon Oct 10 23:00:00 BRT 2011

What I expected was:

startdate: Sun Oct 10 00:00:00 BRT 2011
enddate: Mon Oct 11 00:00:00 BRT 2011

Notice the difference in timezone (BRST on the system and BRT when logged). Brazil changed their timezone to BRST on October 16th of 2011. It appears as if BIRT is taking the start/end date parameters as BRST (midnight) and then converting them to BRT (one hour before midnight), thus the hour being pushed back by one, which does not seem practical.

Any ideas?

Thanks.

Re: Problem with date params [message #762920 is a reply to message #762889] Thu, 08 December 2011 20:11 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

BIRT does have a timezone parameter that can be passed in the url.
__timezone=value
Not sure this will help in this situation but may be worth a try.

Jason

On 12/8/2011 2:21 PM, birtforums7 wrote:
> When I run a report through the BIRT report designer (2.3.2), there is a
> discrepancy between the date parameters that I put in for the start and
> end date, and the start and end dates that are actually displayed if I
> try to output them to a log file.
>
> The problem seems to only occur for dates between October 10, 2011 to
> October 16, 2011.
>
> For instance, if I set my start date parameter to 10/10/2011 and my end
> date parameter to 10/16/2011, I receive the following log output:
>
> Fri Nov 18 15:31:27 BRST 2011 DEBUG startdate: Sun Oct 09 23:00:00 BRT 2011
> Fri Nov 18 15:31:27 BRST 2011 DEBUG enddate: Sat Oct 15 23:00:00 BRT 2011
>
> What I expected was:
>
> Fri Nov 18 15:31:27 BRST 2011 DEBUG startdate: Sun Oct 10 00:00:00 BRT 2011
> Fri Nov 18 15:31:27 BRST 2011 DEBUG enddate: Sat Oct 16 00:00:00 BRT 2011
>
> If I were to choose 10/10/2011 to 10/11/2011, I would receive the
> following output:
>
> startdate: Sun Oct 09 23:00:00 BRT 2011
> enddate: Mon Oct 10 23:00:00 BRT 2011
>
> What I expected was:
>
> startdate: Sun Oct 10 00:00:00 BRT 2011
> enddate: Mon Oct 11 00:00:00 BRT 2011
>
> Notice the difference in timezone (BRST on the system and BRT when
> logged). Brazil changed their timezone to BRST on October 16th of 2011.
> It appears as if BIRT is taking the start/end date parameters as BRST
> (midnight) and then converting them to BRT (one hour before midnight),
> thus the hour being pushed back by one, which does not seem practical.
>
> Any ideas?
>
> Thanks.
>
>
Re: Problem with date params [message #763101 is a reply to message #762889] Fri, 09 December 2011 07:07 Go to previous messageGo to next message
Colin  is currently offline Colin
Messages: 14
Registered: September 2010
Junior Member
The Brazil change in tzdata2011m, which can be installed with tzupdater
1.3.44 or later, is not in the latest JREs 5u31 or 6u26.

See www.oracle.com/technetwork/java/javase/tzdata-versions-138805.html Or
wait for the next JRE Update.

---
Colin

birtforums7 <forums-noreply@eclipse.org> wrote:
> When I run a report through the BIRT report designer (2.3.2), there is a
> discrepancy between the date parameters that I put in for the start and
> end date, and the start and end dates that are actually displayed if I
> try to output them to a log file.
>
> The problem seems to only occur for dates between October 10, 2011 to October 16, 2011.
>
> For instance, if I set my start date parameter to 10/10/2011 and my end
> date parameter to 10/16/2011, I receive the following log output:
>
> Fri Nov 18 15:31:27 BRST 2011 DEBUG startdate: Sun Oct 09 23:00:00 BRT 2011
> Fri Nov 18 15:31:27 BRST 2011 DEBUG enddate: Sat Oct 15 23:00:00 BRT 2011
>
> What I expected was:
>
> Fri Nov 18 15:31:27 BRST 2011 DEBUG startdate: Sun Oct 10 00:00:00 BRT 2011
> Fri Nov 18 15:31:27 BRST 2011 DEBUG enddate: Sat Oct 16 00:00:00 BRT 2011
>
> If I were to choose 10/10/2011 to 10/11/2011, I would receive the following output:
>
> startdate: Sun Oct 09 23:00:00 BRT 2011
> enddate: Mon Oct 10 23:00:00 BRT 2011
>
> What I expected was:
>
> startdate: Sun Oct 10 00:00:00 BRT 2011
> enddate: Mon Oct 11 00:00:00 BRT 2011
>
> Notice the difference in timezone (BRST on the system and BRT when
> logged). Brazil changed their timezone to BRST on October 16th of 2011.
> It appears as if BIRT is taking the start/end date parameters as BRST
> (midnight) and then converting them to BRT (one hour before midnight),
> thus the hour being pushed back by one, which does not seem practical.
>
> Any ideas?
>
> Thanks.
Re: Problem with date params [message #763415 is a reply to message #763101] Fri, 09 December 2011 18:18 Go to previous messageGo to next message
A N is currently offline A N
Messages: 15
Registered: December 2011
Junior Member
Jason,

Thanks for the suggestion. I am not sure what value to specify for the parameter, do i just input GMT-2? Or do I need some sort of location code like America/Brazil? Is there any sort of documentation for this?

Colin,

Thanks for the link. I read the change log for version tzdata2011m, and it seems that the update is only for a very specific part of Brazil, namely Bahia, Brazil. However, the problem I described uses a different timezone, Brasilia, which is in BRST right now, so I am not sure if the update will impact the results.

Any other thoughts?

Thanks.
Re: Problem with date params [message #764644 is a reply to message #763415] Mon, 12 December 2011 15:28 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Use the timezone id like:

&__timezone=Pacific/Midway

Take a look at the bottom of this post for available timezones in the
time zone class:
http://tutorials.jenkov.com/java-date-time/java-util-timezone.html

Jason

On 12/9/2011 1:18 PM, birtforums7 wrote:
> Jason,
>
> Thanks for the suggestion. I am not sure what value to specify for the
> parameter, do i just input GMT-2? Or do I need some sort of location
> code like America/Brazil? Is there any sort of documentation for this?
>
> Colin,
>
> Thanks for the link. I read the change log for version tzdata2011m, and
> it seems that the update is only for a very specific part of Brazil,
> namely Bahia, Brazil. However, the problem I described uses a different
> timezone, Brasilia, which is in BRST right now, so I am not sure if the
> update will impact the results.
>
> Any other thoughts?
>
> Thanks.
Re: Problem with date params [message #764908 is a reply to message #764644] Tue, 13 December 2011 04:32 Go to previous messageGo to next message
A N is currently offline A N
Messages: 15
Registered: December 2011
Junior Member
Thanks for the reply Jason. I looked at the link you posted, but I am not sure if it will address the problem I have. That is, the logs show the timezone as correct already, it just seems that BIRT is not passing the parameter correctly.

For instance, suppose I input a start and end date range of 10/10/11 to 10/15/11. The header on the report displays correctly:

Start Date: 10/10/11
End Date: 10/15/11

The information for the start date in the header was retrieved as follows:

<structure>
<property name="name">startdate</property>
<expression name="expression">params["startdate"]</expression>
<property name="dataType">date-time</property>
</structure>


The header takes the time from startdate, which is from params["startdate"]. However, when I output the contents of params["startdate"] to a log, I receive this:

Sun Oct 09 23:00:00 BRT 2011
Fri Oct 14 23:00:00 BRT 2011

The code for outputting to the log was:

out = new PrintWriter(new FileWriter("c:/temp/out.txt", true));
out.println(params["startdate"]);
out.println(params["enddate"]);
out.close();


It is important for params["startdate"] to be exactly what the user inputs, since the parameter will be formatted for use in an SQL query. The same issue applies to params["enddate"] as well. It seems there is some sort of date conversion from the range of 10/10/2011 to 10/16/2011.

If I use any other time range that does not fall within these two dates, I receive the expected output. For instance:

Header:
Start Date: 10/5/11
End Date: 10/8/11

Log output:
Wed Oct 05 00:00:00 BRT 2011
Sat Oct 08 00:00:00 BRT 2011

Is it possible that this is a bug in BIRT?

Re: Problem with date params [message #765228 is a reply to message #764908] Tue, 13 December 2011 16:59 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

This may be a bug. Can you log a bugzilla request to investigate?

Jason

On 12/12/2011 11:32 PM, birtforums7 wrote:
> Thanks for the reply Jason. I looked at the link you posted, but I am
> not sure if it will address the problem I have. That is, the logs show
> the timezone as correct already, it just seems that BIRT is not passing
> the parameter correctly.
>
> For instance, suppose I input a start and end date range of 10/10/11 to
> 10/15/11. The header on the report displays correctly:
>
> Start Date: 10/10/11
> End Date: 10/15/11
>
> The information for the start date in the header was retrieved as follows:
>
>
> <structure>
> <property name="name">startdate</property>
> <expression name="expression">params["startdate"]</expression>
> <property name="dataType">date-time</property>
> </structure>
>
>
> The header takes the time from startdate, which is from
> params["startdate"]. However, when I output the contents of
> params["startdate"] to a log, I receive this:
>
> Sun Oct 09 23:00:00 BRT 2011
> Fri Oct 14 23:00:00 BRT 2011
>
> The code for outputting to the log was:
>
>
> out = new PrintWriter(new FileWriter("c:/temp/out.txt", true));
> out.println(params["startdate"]);
> out.println(params["enddate"]);
> out.close();
>
>
> It is important for params["startdate"] to be exactly what the user
> inputs, since the parameter will be formatted for use in an SQL query.
> The same issue applies to params["enddate"] as well. It seems there is
> some sort of date conversion from the range of 10/10/2011 to 10/16/2011.
>
> If I use any other time range that does not fall within these two dates,
> I receive the expected output. For instance:
>
> Header:
> Start Date: 10/5/11
> End Date: 10/8/11
>
> Log output:
> Wed Oct 05 00:00:00 BRT 2011
> Sat Oct 08 00:00:00 BRT 2011
>
> Is it possible that this is a bug in BIRT?
>
>
Re: Problem with date params [message #765307 is a reply to message #765228] Tue, 13 December 2011 20:18 Go to previous message
A N is currently offline A N
Messages: 15
Registered: December 2011
Junior Member
Submitted a request. Thanks.
Previous Topic:How to use some variable in Report Parameter input before starting report?
Next Topic:Translating from Reorting Services to BIRT
Goto Forum:
  


Current Time: Thu Oct 23 19:27:36 GMT 2014

Powered by FUDForum. Page generated in 0.02039 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software