Jump to content
Changes to the Jaspersoft community edition download ×

time not displaying correctly


quantzie

Recommended Posts

 Hi everyone! I am having some problems with some time output. I've created 2 parameters in iReports:

FROM_TIME

TO_TIME

and these are in java.sql.timestamp. These 2 are my time inputs. These 2 parameters are then transferred to another 2 parameters called

TIME1

TIME2 

where the expressions for them are new java.text.SimpleDateFormat(" kk:mm:ss").format($P{FROM_TIME}) and new java.text.SimpleDateFormat(" kk:mm:ss").format($P{TO_TIME}). This is to change them to a time format in hours, minutes and seconds. I need this step because it is passed back into my SQL query

 

and   r."rec-time" >= date_part('hour',(('2000-01-01' ||$P{TIME1})::timestamp)) * 3600 +

                      date_part('minute',(('2000-01-01' ||$P{TIME1})::timestamp)) * 60 +

                      date_part('second',(('2000-01-01' || $P{TIME1})::timestamp))

and   r."rec-time" <= date_part('hour',(('2000-01-01' ||$P{TIME2})::timestamp)) * 3600 +

                      date_part('minute',(('2000-01-01' || $P{TIME2})::timestamp)) * 60 +

                      date_part('second',(('2000-01-01' || $P{TIME2})::timestamp))

 

Since my data is calculated in seconds, this is the only method that I can think of. Whenever I use preview, everything works perfectly. But when I upload my report onto the Jasper repository and run iReport, a Date/time input of FROM_TIME and TO_TIME using 9:00:00 and 17:00:00 becomes 9:09:09 and 17:17:17. The funny thing is that when I run the report in localhost:8080/jasperserver it actually works!

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