Jump to content
We've recently updated our Privacy Statement, available here ×

Time not calculating correctly


quantzie

Recommended Posts

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

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 the report, 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. Does anyone know why it is running fine in iReports but once it is being used in the repository, it bugs up the time input?

 

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