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)
Time problem
mohanish
Hi Mike
I have a problem and i need some help ... Suppose lets say i have a time as 26 hrs :11 min :07 secs .. what BIRT is doing after changing the date format to HH:mm:ss is 02:11:07 which means 1day 02 hrs :11 min :07 secs but i don't see 1day after using the format HH:mm:ss ..Is it possible to get 26hrs or 1day anyhow or is there any workaround.Please help me out ....
thanks a lot :-)
Find more posts tagged with
Comments
mwilliams
Creating your own string representation of the same would work for this. Or am I missing something?
mohanish
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="85491" data-time="1321650636" data-date="18 November 2011 - 02:10 PM"><p>
Creating your own string representation of the same would work for this. Or am I missing something?<br /></p></blockquote>
<br />
<br />
Hi Mike ,<br />
<br />
<br />
I did not get you.How can i change that to a string as i need in in <strong class='bbc'>hh:mm:ss</strong> format .... what about the <strong class='bbc'>hr</strong> as it crosses <strong class='bbc'>24</strong>.I don't have any problems with <strong class='bbc'>mm </strong>and <strong class='bbc'>ss </strong>.
mwilliams
How does this field come into your report? Is it coming from your database or are you taking the difference between two dates within BIRT? Let me know. Also, let me know your BIRT version.
mohanish
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="85546" data-time="1321891924" data-date="21 November 2011 - 09:12 AM"><p>
How does this field come into your report? Is it coming from your database or are you taking the difference between two dates within BIRT? Let me know. Also, let me know your BIRT version.<br /></p></blockquote>
<br />
<br />
let me explain the scenario ....<br />
<br />
I have a field which contains the difference of time in seconds.Then I did an aggregate with the column binding name as <strong class='bbc'>tot_sec</strong> with the SUM option and got the total number of seconds which is fine for me. Then I used your expression given below <br />
<strong class='bbc'>BirtDateTime.addSecond(new Date(0,0,0,0,0,0),row["tot_sec"])</strong><br />
with a new data column binding and data type as Date Time. Then I did a Format Date Time on the field where I used the custom option <strong class='bbc'>HH:mm:ss</strong>.<br />
<br />
Now let me explain in figures ..<br />
<br />
I get a total secs as 93666 ... upon changing it to <strong class='bbc'>HH:mm:ss</strong> should give me <strong class='bbc'>26:01:06</strong> but BIRT gives me <strong class='bbc'>02:01:06</strong> ... so that 24hrs is lost.<br />
<br />
I use BIRT EUROPA version.
mwilliams
Ok, I understand now. I can explain my explanation further now, knowing how your data comes in. You can create a column that creates a string representation of the same by doing something like:
days = Math.floor(row["tot_sec"]/86400);
temp = row["tot_sec"] - (days * 86400);
Now, you have two options. "temp" contains the seconds left that don't equal a whole day, so you could make a date out of this, format it, then use:
days.toString() + " day(s) " + myDate.toString();
This would give you something like: "1 day(s) 02:01:06"
Or, you could finish figuring out the hours, minutes, and leftover seconds like above and create the entire string yourself.
If you wanted to keep the format 26:01:06, you'd simply not figure the "days" part and start with hours and create your whole string to display.
Hope this helps. Let me know if you have any further questions.
mohanish
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="85638" data-time="1322002304" data-date="22 November 2011 - 03:51 PM"><p>
Ok, I understand now. I can explain my explanation further now, knowing how your data comes in. You can create a column that creates a string representation of the same by doing something like:<br />
<br />
days = Math.floor(row["tot_sec"]/86400);<br />
temp = row["tot_sec"] - (days * 86400);<br />
<br />
Now, you have two options. "temp" contains the seconds left that don't equal a whole day, so you could make a date out of this, format it, then use:<br />
<br />
days.toString() + " day(s) " + myDate.toString();<br />
<br />
This would give you something like: "1 day(s) 02:01:06"<br />
<br />
Or, you could finish figuring out the hours, minutes, and leftover seconds like above and create the entire string yourself.<br />
<br />
If you wanted to keep the format 26:01:06, you'd simply not figure the "days" part and start with hours and create your whole string to display.<br />
<br />
Hope this helps. Let me know if you have any further questions.<br /></p></blockquote>
<br />
<br />
BIRT GURU you are a real <strong class='bbc'>GURU</strong> ...thank u so much ... It solved my problem ... again thanks a lot :-)
mwilliams
You're welcome! Let us know whenever you have questions!