khidesre Posted May 2 Share Posted May 2 Hello, I have two timestamp fields $F{STARTDATE} and $F{ENDDATE}. When I run the report, they both look like this: 2024-01-22, 11:00 a.m. For these two fields, I only need the time so the expression behind both fields is: new SimpleDateFormat("hh:mm a").format($F{STARTDATE}) and new SimpleDateFormat("hh:mm a").format($F{ENDDATE}). This gets only the time, so it displays 11:00 am. Now I have another variable called $V{duration} which needs to get the amount of time between the end date and start date fields which are timestamps. So, it would be $F{STARTDATE} - $F{ENDDATE}. I can't figure out how to do this no matter how I tried. How can I calculate the difference and then convert it into days because the output should look like 1.5 + "days". I'm using Jaspersoft® Studio 6.20.6 - Visual Designer for JasperReports 6.20.6. Thank you in advance. R Link to comment Share on other sites More sharing options...
shreekrishna.shankhwar Posted May 5 Share Posted May 5 It is easy to do through query, Don't use jasper to calculate the time difference. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now