java - date appears one day prior to what is programmed in JasperServer -
I posted it on the JasperServer forum, but I usually get better fortune on stack overflow. Please help if you can. My biggest complaint about JasperServer
is that it behaves differently from flat out JasperReport
(in particular, IReport
). Now I see that the date given in the parameter is displayed one day before (actually, exactly 4 hours before) given in the parameter.
It is that I put the default value of JRX in the expression:
((New date). GetMonth () / 3) + 1 == 1)? Get new date (new date) (), 0, 1): ((New date). GetMonth () / 3) + 1 == 2)? Get new date (new date) (), 3, 1): ((New date). GetMonth () / 3) + 1 == 3)? New Date (New Date). GetYear (), 6, 1): New Date (New Date). GetYear (), 9, 1)
This code works to correctly calculate JasperReports
from the default value expression within the beginning of the quarter when I run it through the iReport
, I do not see any problem I have run the report in this quarter, I am seeing it as a starting date on July 1, 2010.
When I Jearaksmel achieve "code: subreport_name" JasperServer and run the report and JasperServer
I have the output emailed me a different result:
This seems like a bug to me.
It looks like time zone problem.
It seems that your date 4 is printing in the past.
Where is the server you are running?
Can you see its time zone?
For example see this code This will print a different day and month depending on the time zone.
DateTit = ((New Date). GetMonth () / 3) + 1 == 1)? Get new date (new date) (), 0, 1): ((New date). GetMonth () / 3) + 1 == 2)? Get new date (new date) (), 3, 1): ((New date). GetMonth () / 3) + 1 == 3)? New Date (New Date) Together (), 6, 1): New Date (New Date) Together (9), 9), 1); Println (date);
Output: Thursday July 01 00:00:00 BST 2010
Timezone.Set Default (Timezone.Gate Time Zone ( "PST")); Println (date);
Output Mercury June 30 16:00:00 PDT 2010 with the same date.
Bit of the hack but you can set hours later to ensure that this is the right day:
New date (new date) . GetYear (), 3, 1,23,59);
Edit:
The correct way to set the time zone is via the Joseps report data source
For example, before going to your report, call setTimeZone ()
method to your data source
mydatasource.setTimeZone (TimeZone.getTimeZone "BST"));
The problem is that a time zone is not set to the server, so your date default uses the default.
Comments
Post a Comment