Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 12:46 Go to next message
Tiago Fre is currently offline Tiago FreFriend
Messages: 2
Registered: February 2013
Junior Member
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 15:58 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

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?

Michael

Developer Evangelist, Silanis
Re: Convert integer to time [message #1015457 is a reply to message #1015453] Thu, 28 February 2013 16:01 Go to previous messageGo to next message
Tiago Fre is currently offline Tiago FreFriend
Messages: 2
Registered: February 2013
Junior Member
Yes
Re: Convert integer to time [message #1015464 is a reply to message #1015457] Thu, 28 February 2013 16:13 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

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;


Michael

Developer Evangelist, Silanis
Previous Topic:split x-axis label into two lines
Next Topic:Chart - Modify legend
Goto Forum:
  


Current Time: Thu Mar 28 14:21:37 GMT 2024

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

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

Back to the top