what is the best format for an attribute that must show duration in following format HH:mm:ss ?
Hi all,
I need to create an attribute that must contain a duration. I will set up this attribute by Java API, but I need to show this attribute in the following format: HH:mm:ss. What type must I use for this attribute? I try with Timestamp, Duration and long (as Time Spent), but I can not show in this format. Any suggestions? |
2 answers
Ralph Schoon (63.1k●3●36●46)
| answered Oct 02 '14, 5:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Here my views on how RTC handles timestamp type attributes: https://rsjazz.wordpress.com/2014/07/22/manage-scheduled-absences-using-the-plainjava-client-libraries/
You would typically use a timestamp attribute, however the way it is displayed is controlled by the Editor Presentation you use and there are only the ones available that RTC provides. You can use a string type, in which chase you would have to format the string as you want it. Please be aware that it will just be a string and not be handled as timestamp. E.g. you would have no date picker. Comments
Luiz Almeida
commented Oct 02 '14, 7:39 a.m.
Ralph,
Hi Luiz, I think you are right. I see no way to get rid of the date. There might be an option to hide the time, but not the date. I also tried the type duration and that does not provide what you desire either.
Ralph,
What do you want to achieve. That is my question, not how you think you can achieve that.
Luiz Almeida
commented Oct 02 '14, 9:32 a.m.
What I need is to check if I attend an SLA. I have 6 hours to attend a task, for example. So I need to know how much time a task stays in a specific state. I am calculating the interval between begin and end of the state and recording this in a timestamp attribute. I don't know if this is the better way, maybe a duration attribute would be better. Do you have any example of how to persist duration attributes? And later is possible to present the attribute in format HH:mm:ss or only in format determined by RTC?
Ralph Schoon
commented Oct 02 '14, 10:36 a.m.
| edited Oct 02 '14, 10:41 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Duration is just another work item attribute type. I have no code but as usual, you can read a duration attribute and look at its class, do the cast and/or search for duration in Java. I think it represents time in milliseconds.
showing 5 of 6
show 1 more comments
|
Hello I don't realy get what you need.
But if you want to do it programmaticaly try this: http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html
Comments
Luiz Almeida
commented Oct 02 '14, 7:39 a.m.
Jonas,
Jonas Studer
commented Oct 02 '14, 8:19 a.m.
Hy Luiz,
Luiz Almeida
commented Oct 02 '14, 8:26 a.m.
Ok, Jonas...I understand you now.
|
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.