Hello community. I'm using TIBCO Jaspersoft® Studio 6.6.0.
My report has a variable that sums the number of seconds of the records listed.
In the summary group, I need to display this variable ($V{total_seconds}) with the format DD:HH:MM:SS.
How should I do?
Many thanks.
1 Answer:
This might not be a clean approach, but provides for your requirements,
Just copy this into your text field in report and replace $V{Report_TotalDuration} with your seconds variable
CONCATENATE(String.valueOf(INTEGER_VALUE(new DecimalFormat("#,##0").format( Math.floor($V{Report_TotalDuration}/(24*3600))))),'days:',INTEGER_VALUE(new DecimalFormat("#,##0").format(Math.floor($V{Report_TotalDuration}/60/60)% 24))<10? "0"+String.valueOf(INTEGER_VALUE(new DecimalFormat("#,##0").format(Math.floor($V{Report_TotalDuration}/60/60)% 24))):String.valueOf(INTEGER_VALUE(new DecimalFormat("#,##0").format(Math.floor($V{Report_TotalDuration}/60/60)% 24))),':',INTEGER_VALUE(new DecimalFormat("#,##0").format(Math.floor($V{Report_TotalDuration}/60) %60))<10? "0"+String.valueOf(INTEGER_VALUE(new DecimalFormat("#,##0").format(Math.floor($V{Report_TotalDuration}/60) %60))):String.valueOf(INTEGER_VALUE(new DecimalFormat("#,##0").format(Math.floor($V{Report_TotalDuration}/60) %60))),':',INTEGER_VALUE(new DecimalFormat("#,##0").format(Math.floor($V{Report_TotalDuration} % 60)))<10? "0"+String.valueOf(INTEGER_VALUE(new DecimalFormat("#,##0").format(Math.floor($V{Report_TotalDuration} % 60)))):String.valueOf(INTEGER_VALUE(new DecimalFormat("#,##0").format(Math.floor($V{Report_TotalDuration} % 60)))))
I solved using another post. Thank you.