Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Convert Integer into Time
highway82
hello,
i have create a birt report white the structure of screenshot001.jpg.
now i need a computed column with the difference time between the "statusArrvial" and "unloadingDatetime". i use the BIRT FUNCTION BirtDateTime.diffMinute() in the expression builder. for result i get an interger-value --> screenshot001.jpg.
i need the time-value (hh:mm) --> screenshot002.jpg.
i hope somebody has an idea. thanks for every hint.
regards, dominik
Find more posts tagged with
Comments
kjawahar
One way is to use the Javascriot to convert the interger to hours and minutes. as below:
var Hours = Math.floor(350/60);
var Minutes = 350%60;
var Time = Hours + ":" + Minutes;
mwilliams
You could use the minutes in the new Date() function, then format your data element you display the date field in to only show the time, since the date will be irrelevant.
highway82
Thanks for your help. I get a Time value.<br />
Now I have following problem, see screenshot001.<br />
<br />
the programming code:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if(row["statusUnloadingArrival Qualifier Custom datetime"]!=null){
if(row["Unloading datetime"]>row["statusUnloadingArrival Qualifier Custom datetime"]){
difference=BirtDateTime.diffMinute(row["statusUnloadingArrival Qualifier Custom datetime"],row["Unloading datetime"])
diffTime=new Date(difference)
displayTime=diffTime;
}else{
displayTime="00:00:00";
}
}else{
</pre>
<br />
the cognition is:<br />
int --> time<br />
XX --> 01:00:00<br />
**** --> 01:00:00<br />
<span style='color: #FF0000'>X</span>**** --> 01:00:0<span style='color: #FF0000'>X</span><br />
<span style='color: #FF0000'>XX</span>**** --> 01:00:<span style='color: #FF0000'>XX</span><br />
<br />
what is the problem??<br />
<br />
i hope somebody has an idea. thanks for every hint.<br />
regards, dominik
mwilliams
I'm guessing it's how you are building your date that is causing the issue. If "difference" is only minutes, you'll need to specify the other values in the new Date() function as well or convert your minutes to milliseconds before putting it into the new Date() function. But putting the following in place of new Date(difference), should work.
new Date(0, 0, 0, 0, difference);
Let me know.