Skip to main content



      Home
Home » Archived » BIRT » Convert integer to time(Convert integer or float to time HH:MM:SS)
Convert integer to time [message #1015383] Thu, 28 February 2013 07:46 Go to next message
Eclipse UserFriend
I'm using version 3.2.20 and I wonder how it is possible to transform a field integer or float for hours format
e.g. 94:59:59
Re: Convert integer to time [message #1015453 is a reply to message #1015383] Thu, 28 February 2013 10:58 Go to previous messageGo to next message
Eclipse UserFriend
You could do the computations yourself to find the hours, minutes, and seconds. It would be a pretty easy script. Is your integer field in seconds?
Re: Convert integer to time [message #1015457 is a reply to message #1015453] Thu, 28 February 2013 11:01 Go to previous messageGo to next message
Eclipse UserFriend
Yes
Re: Convert integer to time [message #1015464 is a reply to message #1015457] Thu, 28 February 2013 11:13 Go to previous message
Eclipse UserFriend
If you put something like this into the script of a label, it'll give you the hh:mm:ss breakdown:

temp = 849384;

hours = Math.floor(temp/3600);
temp = temp % 3600;
minutes = Math.floor(temp/60);
if(minutes.length == 1){
minutes = "0" + minutes;
}
seconds = temp % 60;
if(seconds.length == 1){
seconds = "0" + seconds;
}

this.text = hours + ":" + minutes + ":" + seconds;
Previous Topic:split x-axis label into two lines
Next Topic:Chart - Modify legend
Goto Forum:
  


Current Time: Wed Mar 19 23:17:46 EDT 2025

Powered by FUDForum. Page generated in 0.03602 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top