Jump to content
JasperReports Library 7.0 is now available ×

Converting a Total Seconds variable (summary) to DD:HH:MM:SS


Recommended Posts

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • 4 years later...

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

Link to comment
Share on other sites

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