Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
how to convert integer to date HH:MM
padytom
<p style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">i used this to compute new column but client wants the result in HH:MM rather than integer which is the default for subtracting time.</p>
<p style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;"> </p>
<p style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;">BirtDateTime.diffHour (BirtDateTime.now(),row["TARGSTARTDATE"])</p>
<div> </div>
Find more posts tagged with
Comments
mwilliams
<p>You could write a simple computed column that creates a string value showing the desired format. If the value will never go over 24 hours, you could create a date time value and format it to only show the time portion of the value. Hopefully one of these helps.</p>
padytom
<p>Thank you for your quick response. I'm new to BIRT could you show me an example?</p>
micajblock
<p>First of all you need to us <span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;font-size:14.4444446563721px;">BirtDateTime.diffMinutes. Attached is an example The minutes are always 0 as there is no time part in my dates.</span></p>
<p> </p>
<p><span style="color:rgb(40,40,40);font-family:'Source Sans Pro', sans-serif;font-size:14.4444446563721px;">The expression looks like this:</span></p>
<pre class="_prettyXprint">
Math.floor(BirtDateTime.diffMinute(row["ORDERDATE"],row["SHIPPEDDATE"])/60) + ":" + BirtDateTime.diffMinute(row["ORDERDATE"],row["SHIPPEDDATE"]) % 60</pre>
padytom
<p>Thank you for your response. This is what the client wants. Taking a look at your report first row, you have 96:0 but he wants it to be 1:36 where 1 is the hr and 36 is mins</p>
mwilliams
<p>padytom,</p>
<p> </p>
<p>The first row is actually 96 hours, if you look at the two dates used. If there were times associated with these dates, you'd see a minutes value populated after the ':'. Try this with some of your actual data and you should see it.</p>
padytom
<p>Thanks a lot. It works now.</p>
padytom
<p>another problem is that, i am trying to apply highlights on the results</p>
<p>i am using something like row[ ] >= '02:00' green</p>
<p>row[ ] between '00:00' and '02:00' red</p>
<p>issue is from 20:00 up turns green but below 20:00 like 19:59 to 0:01 all turns red</p>
mwilliams
<p>Use your original integer column to create your expressions or you could split the string by ':' and parse each string to an integer to compare the hour and minute values. If you need me to update the example with one or both of these, let me know.</p>
padytom
<p>please do. that is what i did originally with just '2' then realized the problem before switching to '2:00' bu still persists</p>
mwilliams
<p>Alright. Take a look at this modification. The left table uses the "minutes" between the two dates. The right table uses the "Difference" string and parses out the hours. You'll find this in the highlights section of the property editor for the detail row of the table.</p>
padytom
<p>Thank you. I've got it running ok. had to point to the original column I created before the math.floor. You guys have been very helpful. I'm getting there small small.</p>
mwilliams
<p>Yep. That's what you'd have needed for the left column way. Glad it's working. Let us know whenever you have questions.
</p>